org.restlet.Request.getRootRef()方法的使用及代码示例

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

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

Request.getRootRef介绍

[英]Returns the application root reference.
[中]返回应用程序根引用。

代码示例

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

/**
 * Returns the application resources base URI.
 * 
 * @return The application resources base URI.
 */
protected Reference getResourcesBase() {
  return getRequest().getRootRef();
}

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

/**
 * Returns the application root reference.
 * 
 * @return The application root reference.
 */
@Override
public Reference getRootRef() {
  return getWrappedRequest().getRootRef();
}

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

/**
 * Generate the HTML representation of this resource.
 */
@Get("html")
public Representation toHtml(Variant variant) throws ResourceException {
  final Map<String, Object> dataModel = new TreeMap<String, Object>();
  dataModel.put("user", this.user);
  dataModel.put("contact", this.contact);
  dataModel.put("resourceRef", getRequest().getResourceRef());
  dataModel.put("rootRef", getRequest().getRootRef());
  return getTemplateRepresentation("contact.html", dataModel,
      MediaType.TEXT_HTML);
}

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

/**
 * Returns the application root reference.
 * 
 * @return The application root reference.
 * @see Request#getRootRef()
 */
public Reference getRootRef() {
  return getRequest() == null ? null : getRequest().getRootRef();
}

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

/**
   * Generate the HTML representation of this resource.
   */
  @Get("html")
  public Representation toHtml() throws ResourceException {
    final Map<String, Object> dataModel = new TreeMap<String, Object>();
    dataModel.put("user", this.user);
    dataModel.put("contacts", this.contacts);
    dataModel.put("resourceRef", getRequest().getResourceRef());
    dataModel.put("rootRef", getRequest().getRootRef());

    return getTemplateRepresentation("user.html", dataModel,
        MediaType.TEXT_HTML);
  }
}

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

/**
 * Generate the HTML representation of this resource.
 */
@Get
public Representation toHtml(Variant variant) throws ResourceException {
  final Map<String, Object> dataModel = new TreeMap<String, Object>();
  dataModel.put("user", this.user);
  dataModel.put("contacts", this.contacts);
  dataModel.put("resourceRef", getRequest().getResourceRef());
  dataModel.put("rootRef", getRequest().getRootRef());
  return getTemplateRepresentation("contacts.html", dataModel,
      MediaType.TEXT_HTML);
}

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

/**
   * Generate the HTML representation of this resource.
   */
  @Get
  public Representation toHtml(Variant variant) throws ResourceException {
    final Map<String, Object> dataModel = new TreeMap<String, Object>();
    dataModel.put("users", this.users);
    dataModel.put("resourceRef", getRequest().getResourceRef());
    dataModel.put("rootRef", getRequest().getRootRef());

    return getTemplateRepresentation("users.html", dataModel,
        MediaType.TEXT_HTML);
  }
}

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

final Map<String, Object> dataModel = new TreeMap<String, Object>();
dataModel.put("resourceRef", nextRequest.getResourceRef());
dataModel.put("rootRef", nextRequest.getRootRef());
dataModel.put("baseUrl", nextRequest.getRootRef().toString());
dataModel.put("clientInfo", nextClientInfo);
dataModel.put("isAuthenticated", nextClientInfo.isAuthenticated());

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

private String getDefaultRedirect()
{
  return this.getRequest().getRootRef().toString()
      + this.getPropertyUtil().get(OasProps.PROP_INDEX_PATH, OasProps.DEF_INDEX_PATH);
}

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

/**
   * Redirects to the given path, using an absolute URI based on this.getRequest().getRootRef().
   * 
   * @param path
   *            The path to redirect to.
   */
  protected void redirectToPath(final String path)
  {
    final String rootRef = this.getRequest().getRootRef().toString(false, false);
    
    final boolean rootHasSlash = rootRef.endsWith("/");
    final boolean pathHasSlash = path.startsWith("/");
    
    if(rootHasSlash && pathHasSlash && path.length() > 1)
    {
      this.getResponse().redirectSeeOther(rootRef + path.substring(1));
    }
    else
    // if((rootHasSlash && !pathHasSlash) || (!rootHasSlash && pathHasSlash))
    {
      this.getResponse().redirectSeeOther(rootRef + path);
    }
  }
}

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

nextDataHandler);
nextResponse.redirectSeeOther(nextRequest.getRootRef().toString(false, false)
    + propertyUtil.get(OasProps.PROP_ONTOLOGY_MANAGER_PATH, OasProps.DEF_ONTOLOGY_MANAGER_PATH));

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

"The request.originalRef must not be null");
final Reference appRootRef = request.getRootRef();
if (appRootRef == null) {
  throw new IllegalArgumentException(

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

/**
 * Returns the resource's relative path.
 * 
 * @return The resource's relative path.
 */
protected String getResourcePath() {
  Reference ref = new Reference(getRequest().getRootRef(), getRequest()
      .getResourceRef());
  return ref.getRemainingPart();
}

代码示例来源:origin: com.github.ansell.restlet-utils/restlet-utils

if(request.getRootRef() != null)
  final String p = request.getRootRef().getPath();
  credentialsCookie.setPath(p == null ? "/" : p);

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

/**
 * Accept the representation of a new user, and create it.
 */
@Post
public void acceptUser(Representation entity) throws ResourceException {
  Form form = new Form(entity);
  User user = new User();
  user.setFirstName(form.getFirstValue("firstName"));
  user.setLastName(form.getFirstValue("lastName"));
  user.setImage(form.getFirstValue("image"));
  try {
    user = getObjectsFacade().createUser(user);
    getResponse().redirectSeeOther(
        getChildReference(getRequest().getResourceRef(),
            user.getId()));
  } catch (ObjectsException e) {
    final Map<String, Object> dataModel = new TreeMap<String, Object>();
    dataModel.put("users", this.users);
    dataModel.put("resourceRef", getRequest().getResourceRef());
    dataModel.put("rootRef", getRequest().getRootRef());
    dataModel.put("firstName", form.getFirstValue("firstName"));
    dataModel.put("lastName", form.getFirstValue("lastName"));
    dataModel.put("image", form.getFirstValue("image"));
    dataModel.put("errorMessage", e.getMessage());
    getResponse().setEntity(
        getTemplateRepresentation("users.html", dataModel,
            MediaType.TEXT_HTML));
  }
}

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

.getRootRef().toString(false, false));

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

this.rootRef = (request.getRootRef() == null) ? null : request
    .getRootRef();

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

.getRootRef().toString(false, false));

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

.getRootRef().toString(false, false));

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

.getRootRef().toString(false, false));

相关文章