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

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

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

Response.getLocationRef介绍

[英]Returns the reference that the client should follow for redirections or resource creations.
[中]

代码示例

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

/**
 * Returns the reference that the client should follow for redirections or
 * resource creations.
 * 
 * @return The redirection reference.
 * @deprecated Use getLocationRef() instead.
 */
@Deprecated
public Reference getRedirectRef() {
  return getLocationRef();
}

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

@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 reference that the client should follow for redirections or
 * resource creations.
 * 
 * @return The redirection reference.
 */
@Override
public Reference getLocationRef() {
  return getWrappedResponse().getLocationRef();
}

代码示例来源: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.sonatype.nexus/nexus-test-harness-launcher

);
serviceURI = response.getLocationRef().toString();

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

/**
 * Posts a member to the collection resulting in the creation of a new
 * resource.
 * 
 * @param member
 *            The member representation to post.
 * @return The reference of the new resource.
 * @throws Exception
 */
public Reference postMember(Representation member) throws Exception {
  final Request request = new Request(Method.POST, getHref(), member);
  final Response response = getWorkspace().getService()
      .getClientDispatcher().handle(request);
  if (response.getStatus().equals(Status.SUCCESS_CREATED)) {
    return response.getLocationRef();
  } else {
    throw new Exception(
        "Couldn't post the member representation. Status returned: "
            + response.getStatus().getDescription());
  }
}

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

if (response.getLocationRef() != null) {
  final Template rt = new Template(this.targetTemplate);
  rt.setLogger(getLogger());
  final int matched = rt.parse(response.getLocationRef().toString(),
      request);

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

this.response.getLocationRef());
} else if (variableName.equals("S")) {
  if (this.response.getStatus() != null) {

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

public ArtifactInfoResource getInfo(String repositoryId, String itemPath)
  throws IOException
{
 Response response = null;
 String entityText;
 try {
  response =
    RequestFacade.sendMessage("service/local/repositories/" + repositoryId + "/content/" + itemPath + "?describe=info",
      Method.GET, new XStreamRepresentation(xstream, "", MediaType.APPLICATION_XML));
  entityText = response.getEntity().getText(); // to make Restlet response buffer it
  if (response.getStatus().getCode() == Status.REDIRECTION_FOUND.getCode()) {
   // follow redirection but only ONCE
   RequestFacade.releaseResponse(response);
   response = RequestFacade.sendMessage(new URL(response.getLocationRef().toString()), Method.GET, new XStreamRepresentation(xstream, "", MediaType.APPLICATION_XML));
   entityText = response.getEntity().getText(); // to make Restlet response buffer it
  }
  assertThat(response, isSuccessful());
 }
 finally {
  RequestFacade.releaseResponse(response);
 }
 XStreamRepresentation rep =
   new XStreamRepresentation(XStreamFactory.getXmlXStream(), entityText, MediaType.APPLICATION_XML);
 ArtifactInfoResourceResponse info =
   (ArtifactInfoResourceResponse) rep.getPayload(new ArtifactInfoResourceResponse());
 return info.getData();
}

相关文章