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

x33g5p2x  于2022-01-29 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(73)

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

Response.setLocationRef介绍

[英]Sets the reference that the client should follow for redirections or resource creations. If you pass a relative location URI, it will be resolved with the current base reference of the request's resource reference (see Request#getResourceRef() and Reference#getBaseRef().
[中]设置客户端重定向或创建资源时应遵循的引用。如果传递相对位置URI,它将使用请求的资源引用的当前基引用进行解析(请参见请求#getResourceRef()和引用#getBaseRef()。

代码示例

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

/**
 * Sets the reference that the client should follow for redirections or
 * resource creations.
 * 
 * @param locationUri
 *            The URI to set.
 * @deprecated Use the setLocationRef() method instead.
 */
@Deprecated
public void setRedirectRef(String locationUri) {
  setLocationRef(locationUri);
}

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

/**
 * Sets the reference that the client should follow for redirections or
 * resource creations.
 * 
 * @param locationRef
 *            The reference to set.
 * @deprecated Use the setLocationRef() method instead.
 */
@Deprecated
public void setRedirectRef(Reference locationRef) {
  setLocationRef(locationRef);
}

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

/**
 * Sets the reference that the client should follow for redirections or
 * resource creations.
 * 
 * @param locationRef
 *            The reference to set.
 */
@Override
public void setLocationRef(Reference locationRef) {
  getWrappedResponse().setLocationRef(locationRef);
}

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

/**
 * Sets the reference that the client should follow for redirections or
 * resource creations.
 * 
 * @param locationUri
 *            The URI to set.
 */
@Override
public void setLocationRef(String locationUri) {
  getWrappedResponse().setLocationRef(locationUri);
}

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

/**
 * Permanently redirects the client to a target URI. The client is expected
 * to reuse the same method for the new request.
 * 
 * @param targetRef
 *            The target URI reference.
 */
public void redirectPermanent(Reference targetRef) {
  setLocationRef(targetRef);
  setStatus(Status.REDIRECTION_PERMANENT);
}

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

/**
 * Temporarily redirects the client to a target URI. The client is expected
 * to reuse the same method for the new request.
 * 
 * @param targetRef
 *            The target reference.
 */
public void redirectTemporary(Reference targetRef) {
  setLocationRef(targetRef);
  setStatus(Status.REDIRECTION_TEMPORARY);
}

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

/**
 * Redirects the client to a different URI that SHOULD be retrieved using a
 * GET method on that resource. This method exists primarily to allow the
 * output of a POST-activated script to redirect the user agent to a
 * selected resource. The new URI is not a substitute reference for the
 * originally requested resource.
 * 
 * @param targetRef
 *            The target reference.
 */
public void redirectSeeOther(Reference targetRef) {
  setLocationRef(targetRef);
  setStatus(Status.REDIRECTION_SEE_OTHER);
}

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

/**
 * Temporarily redirects the client to a target URI. The client is expected
 * to reuse the same method for the new request.<br>
 * <br>
 * If you pass a relative target URI, it will be resolved with the current
 * base reference of the request's resource reference (see
 * {@link Request#getResourceRef()} and {@link Reference#getBaseRef()}.
 * 
 * @param targetUri
 *            The target URI.
 */
public void redirectTemporary(String targetUri) {
  setLocationRef(targetUri);
  setStatus(Status.REDIRECTION_TEMPORARY);
}

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

/**
 * Permanently redirects the client to a target URI. The client is expected
 * to reuse the same method for the new request.<br>
 * <br>
 * If you pass a relative target URI, it will be resolved with the current
 * base reference of the request's resource reference (see
 * {@link Request#getResourceRef()} and {@link Reference#getBaseRef()}.
 * 
 * @param targetUri
 *            The target URI.
 */
public void redirectPermanent(String targetUri) {
  setLocationRef(targetUri);
  setStatus(Status.REDIRECTION_PERMANENT);
}

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

/**
 * Redirects the client to a different URI that SHOULD be retrieved using a
 * GET method on that resource. This method exists primarily to allow the
 * output of a POST-activated script to redirect the user agent to a
 * selected resource. The new URI is not a substitute reference for the
 * originally requested resource.<br>
 * <br>
 * If you pass a relative target URI, it will be resolved with the current
 * base reference of the request's resource reference (see
 * {@link Request#getResourceRef()} and {@link Reference#getBaseRef()}.
 * 
 * @param targetUri
 *            The target URI.
 */
public void redirectSeeOther(String targetUri) {
  setLocationRef(targetUri);
  setStatus(Status.REDIRECTION_SEE_OTHER);
}

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

getLogger().log(Level.INFO,
    "Redirecting client to found location: " + targetRef);
response.setLocationRef(targetRef);
response.setStatus(Status.REDIRECTION_FOUND);
break;
getLogger().log(Level.INFO,
    "Redirecting client to another location: " + targetRef);
response.setLocationRef(targetRef);
response.setStatus(Status.REDIRECTION_SEE_OTHER);
break;

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

response.setLocationRef(baseRef.toString() + remainingPart);

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

/**
 * Sets the reference that the client should follow for redirections or
 * resource creations. If you pass a relative location URI, it will be
 * resolved with the current base reference of the request's resource
 * reference (see {@link Request#getResourceRef()} and
 * {@link Reference#getBaseRef()}.
 * 
 * @param locationUri
 *            The URI to set.
 */
public void setLocationRef(String locationUri) {
  Reference baseRef = null;
  if (getRequest().getResourceRef() != null) {
    if (getRequest().getResourceRef().getBaseRef() != null) {
      baseRef = getRequest().getResourceRef().getBaseRef();
    } else {
      baseRef = getRequest().getResourceRef();
    }
  }
  setLocationRef(new Reference(baseRef, locationUri).getTargetRef());
}

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

file.getRepositoryItemUid().getPath());
response.setLocationRef(fileReference);

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

file.getRepositoryItemUid().getPath() );
response.setLocationRef( fileReference );

相关文章