org.restlet.data.Reference.getBaseRef()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.restlet.data.Reference.getBaseRef方法的一些代码示例,展示了Reference.getBaseRef的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.getBaseRef方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:getBaseRef

Reference.getBaseRef介绍

[英]Returns the base reference for relative references.
[中]返回相对引用的基引用。

代码示例

代码示例来源:origin: internetarchive/heritrix3

/**
 * Constructs a nested Map data structure with the information represented
 * by this Resource. The result is particularly suitable for use with with
 * {@link XmlMarshaller}.
 * 
 * @return the nested Map data structure
 */
protected CrawlJobModel makeDataModel() {
  String baseRef = getRequest().getResourceRef().getBaseRef().toString();
  if (!baseRef.endsWith("/")) {
    baseRef += "/";
  }
  return new CrawlJobModel(cj,baseRef);
}

代码示例来源:origin: internetarchive/heritrix3

/**
 * Constructs a nested Map data structure with the information represented
 * by this Resource. The result is particularly suitable for use with with
 * {@link XmlMarshaller}.
 * 
 * @return the nested Map data structure
 */
protected EngineModel makeDataModel() {
  String baseRef = getRequest().getResourceRef().getBaseRef().toString();
  if(!baseRef.endsWith("/")) {
    baseRef += "/";
  }
  
  return new EngineModel(getEngine(), baseRef);
}

代码示例来源:origin: internetarchive/heritrix3

Reference baseRef = getRequest().getResourceRef().getBaseRef();

代码示例来源:origin: internetarchive/heritrix3

protected void writeHtml(Writer writer) {
    String baseRef = getRequest().getResourceRef().getBaseRef().toString();
    if(!baseRef.endsWith("/")) {
      baseRef += "/";
    }
    Configuration tmpltCfg = getTemplateConfiguration();

    ViewModel viewModel = new ViewModel();
    viewModel.setFlashes(Flash.getFlashes(getRequest()));
    viewModel.put("baseRef",baseRef);
    viewModel.put("model",makeDataModel());

    try {
      Template template = tmpltCfg.getTemplate("Beans.ftl");
      template.process(viewModel, writer);
      writer.flush();
    } catch (IOException e) { 
      throw new RuntimeException(e); 
    } catch (TemplateException e) { 
      throw new RuntimeException(e); 
    }
    
  }
}

代码示例来源:origin: internetarchive/heritrix3

Reference baseRef = getRequest().getResourceRef().getBaseRef();

代码示例来源:origin: internetarchive/heritrix3

protected void writeHtml(Writer writer) {
  EngineModel model = makeDataModel();
  String baseRef = getRequest().getResourceRef().getBaseRef().toString();
  if(!baseRef.endsWith("/")) {
    baseRef += "/";
  }
  Configuration tmpltCfg = getTemplateConfiguration();
  ViewModel viewModel = new ViewModel();
  viewModel.setFlashes(Flash.getFlashes(getRequest()));
  viewModel.put("baseRef",baseRef);
  viewModel.put("fileSeparator", File.separator);
  viewModel.put("engine", model);
  try {
    Template template = tmpltCfg.getTemplate("Engine.ftl");
    template.process(viewModel, writer);
    writer.flush();
  } catch (IOException e) { 
    throw new RuntimeException(e); 
  } catch (TemplateException e) { 
    throw new RuntimeException(e); 
  }
}

代码示例来源:origin: internetarchive/heritrix3

protected void writeHtml(Writer writer) {
  String baseRef = getRequest().getResourceRef().getBaseRef().toString();
  if(!baseRef.endsWith("/")) {
    baseRef += "/";
  }
  Configuration tmpltCfg = getTemplateConfiguration();
  ViewModel viewModel = new ViewModel();
  viewModel.setFlashes(Flash.getFlashes(getRequest()));
  viewModel.put("baseRef",baseRef);
  viewModel.put("job", makeDataModel());
  viewModel.put("heapReport", getEngine().heapReportData());
  try {
    Template template = tmpltCfg.getTemplate("Job.ftl");
    template.process(viewModel, writer);
    writer.flush();
  } catch (IOException e) { 
    throw new RuntimeException(e); 
  } catch (TemplateException e) { 
    throw new RuntimeException(e); 
  }
  
}

代码示例来源:origin: internetarchive/heritrix3

protected void writeHtml(Writer writer) {
    
    String baseRef = getRequest().getResourceRef().getBaseRef().toString();
    if(!baseRef.endsWith("/")) {
      baseRef += "/";
    }
    Configuration tmpltCfg = getTemplateConfiguration();

    ViewModel viewModel = new ViewModel();
    viewModel.setFlashes(Flash.getFlashes(getRequest()));
    viewModel.put("baseRef",baseRef);
    viewModel.put("staticRef", getStaticRef(""));
    viewModel.put("baseResourceRef",getRequest().getRootRef().toString()+"/engine/static/");
    viewModel.put("model", makeDataModel());
    viewModel.put("selectedEngine", chosenEngine);

    try {
      Template template = tmpltCfg.getTemplate("Script.ftl");
      template.process(viewModel, writer);
      writer.flush();
    } catch (IOException e) { 
      throw new RuntimeException(e); 
    } catch (TemplateException e) { 
      throw new RuntimeException(e); 
    }

  }
}

代码示例来源:origin: internetarchive/heritrix3

/**
 * Constructs a nested Map data structure with the information represented
 * by this Resource. The result is particularly suitable for use with with
 * {@link XmlMarshaller}.
 * 
 * @return the nested Map data structure
 */
protected ScriptModel makeDataModel() {
  
  String baseRef = getRequest().getResourceRef().getBaseRef().toString();
  if(!baseRef.endsWith("/")) {
    baseRef += "/";
  }
  Reference baseRefRef = new Reference(baseRef);
  
  ScriptModel model = new ScriptModel(scriptingConsole,
      new Reference(baseRefRef, "..").getTargetRef().toString(),
      getAvailableScriptEngines());
  return model;
}

代码示例来源:origin: internetarchive/heritrix3

new Reference(getRequest().getResourceRef().getBaseRef(), "..").getTargetRef().toString(), 
beanPath, 
bean,

代码示例来源:origin: org.restlet/org.restlet

/**
 * Returns the current reference as a relative reference to the current base
 * reference. This method should only be invoked for absolute references,
 * otherwise an IllegalArgumentException will be raised.
 * 
 * @return The current reference as a relative reference to the current base
 *         reference.
 * @see #getRelativeRef(Reference)
 */
public Reference getRelativeRef() {
  return getRelativeRef(getBaseRef());
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

private Reference updateBaseRefPath(Reference reference) {
 if (reference.getBaseRef().getPath() == null) {
  reference.getBaseRef().setPath("/");
 }
 else if (!reference.getBaseRef().getPath().endsWith("/")) {
  reference.getBaseRef().setPath(reference.getBaseRef().getPath() + "/");
 }
 return reference;
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs

private String getBaseUriStr() {
  if (this.baseUri == null) {
    final Reference baseRef = this.referenceCut.getBaseRef();
    if (baseRef != null) {
      this.baseUri = baseRef.toString(false, false);
    }
  }
  return this.baseUri;
}

代码示例来源:origin: org.sonatype.nexus/nexus-rest-api

private Reference updateBaseRefPath( Reference reference )
{
  if ( reference.getBaseRef().getPath() == null )
  {
    reference.getBaseRef().setPath( "/" );
  }
  else if ( !reference.getBaseRef().getPath().endsWith( "/" ) )
  {
    reference.getBaseRef().setPath( reference.getBaseRef().getPath() + "/" );
  }
  return reference;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Returns the current reference as a relative reference to the current base
 * reference. This method should only be invoked for absolute references,
 * otherwise an IllegalArgumentException will be raised.
 * 
 * @return The current reference as a relative reference to the current base
 *         reference.
 * @see #getRelativeRef(Reference)
 */
public Reference getRelativeRef() {
  return getRelativeRef(getBaseRef());
}

代码示例来源:origin: org.restlet.osgi/org.restlet

private String getVariantsBaseReference() {
  String baseRef = getReference().getBaseRef().toString(false, false);
  if (!baseRef.endsWith("/")) {
    baseRef += "/";
  }
  int lastIndex = this.relativePart.lastIndexOf("/");
  if (lastIndex != -1) {
    baseRef += this.relativePart.substring(0, lastIndex);
  }
  return baseRef;
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

protected Reference createRootReference(Request request, String relPart) {
 Reference ref = new Reference(getContextRoot(request), relPart);
 if (!ref.getBaseRef().getPath().endsWith("/")) {
  ref.getBaseRef().setPath(ref.getBaseRef().getPath() + "/");
 }
 return ref.getTargetRef();
}

代码示例来源:origin: org.sonatype.nexus/nexus-rest-api

protected Reference createRootReference( Request request, String relPart )
{
  Reference ref = new Reference( getContextRoot( request ), relPart );
  if ( !ref.getBaseRef().getPath().endsWith( "/" ) )
  {
    ref.getBaseRef().setPath( ref.getBaseRef().getPath() + "/" );
  }
  return ref.getTargetRef();
}

代码示例来源:origin: org.restlet.osgi/org.restlet

@Override
  protected int beforeHandle(Request request, Response response) {
    final int result = super.beforeHandle(request, response);
    // Set the request's root reference
    request.setRootRef(request.getResourceRef().getBaseRef());
    // Save the hash code of the current host
    setCurrent(VirtualHost.this.hashCode());
    return result;
  }
};

代码示例来源:origin: org.restlet/org.restlet

@Override
  protected int beforeHandle(Request request, Response response) {
    final int result = super.beforeHandle(request, response);
    // Set the request's root reference
    request.setRootRef(request.getResourceRef().getBaseRef());
    // Save the hash code of the current host
    setCurrent(VirtualHost.this.hashCode());
    return result;
  }
};

相关文章

Reference类方法