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

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

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

Reference.toString介绍

[英]Returns the reference as an URI string.
[中]将引用作为URI字符串返回。

代码示例

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

protected String getStaticRef(String resource) {
    String rootRef = getRequest().getRootRef().toString();
    return rootRef + "/engine/static/" + resource;
  }
}

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

protected String getStaticRef(String resource) {
  String rootRef = dirResource.getRequest().getRootRef().toString();
  return rootRef + "/engine/static/" + resource;
}

代码示例来源: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

/**
 * 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

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

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

/**
   * Construct navigational URI for given parameters.
   * 
   * @param pos desired position in file
   * @param lines desired signed line count
   * @param reverse if line ordering should be displayed in reverse
   * @return String URI appropriate to navigate to desired view
   */
  protected String getControlUri(long pos, int lines, boolean reverse) {
    Form query = new Form(); 
    query.add("format","paged");
    if(pos!=0) {
      query.add("pos", Long.toString(pos));
    }
    if(lines!=128) {
      if(Math.abs(lines)<1) {
        lines = 1;
      }
      query.add("lines",Integer.toString(lines));
    }
    if(reverse) {
      query.add("reverse","y");
    }
    Reference viewRef = dirResource.getRequest().getOriginalRef().clone(); 
    viewRef.setQuery(query.getQueryString());
    
    return viewRef.toString(); 
  }
}

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

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

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

/**
 * Constructor from an URI reference (most likely relative).
 * 
 * @param baseRef
 *            The base reference.
 * @param uriReference
 *            The URI reference, either absolute or relative.
 */
public Reference(Reference baseRef, Reference uriReference) {
  this(baseRef, uriReference.toString());
}

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

/**
 * Constructor.
 * 
 * @param localRef
 *            The local reference.
 */
public LocalReference(Reference localRef) {
  super(localRef.toString());
}

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

/**
 * Constructor from an URI reference (most likely relative).
 * 
 * @param baseRef
 *            The base reference.
 * @param uriReference
 *            The URI reference, either absolute or relative.
 */
public Reference(Reference baseRef, Reference uriReference) {
  this(baseRef, uriReference.toString());
}

代码示例来源:origin: org.sonatype.nexus/nexus-test-utils

@Override
  protected boolean matchesSafely( Response item )
  {
    final Reference ref = item.getLocationRef();
    MatcherAssert.assertThat( ref, notNullValue() );
    return matcher.matches( ref.toString() );
  }
}

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

/**
 * Returns the relative part of relative references, without the query and
 * fragment. If the reference is absolute, then null is returned.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The relative part.
 */
public String getRelativePart() {
  return isRelative() ? toString(false, false) : null;
}

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

/**
 * Returns the relative part of relative references, without the query and
 * fragment. If the reference is absolute, then null is returned.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The relative part.
 */
public String getRelativePart() {
  return isRelative() ? toString(false, false) : null;
}

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

/**
 * Converts to a {@link java.net.URI} instance. Note that relative
 * references are resolved before conversion using the {@link #getTargetRef()} method.
 * 
 * @return A {@link java.net.URI} instance.
 */
public java.net.URI toUri() {
  return java.net.URI.create(getTargetRef().toString());
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Returns the relative part of relative references, without the query and
 * fragment. If the reference is absolute, then null is returned.<br>
 * Note that no URI decoding is done by this method.
 * 
 * @return The relative part.
 */
public String getRelativePart() {
  return isRelative() ? toString(false, false) : null;
}

代码示例来源: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;
}

相关文章

Reference类方法