/** * 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(); }
@Override protected boolean matchesSafely(Response item) { final Reference ref = item.getLocationRef(); MatcherAssert.assertThat(ref, notNullValue()); return matcher.matches(ref.toString()); } }
/** * Returns the reference that the client should follow for redirections or * resource creations. * * @return The redirection reference. */ @Override public Reference getLocationRef() { return getWrappedResponse().getLocationRef(); }
@Override protected boolean matchesSafely( Response item ) { final Reference ref = item.getLocationRef(); MatcherAssert.assertThat( ref, notNullValue() ); return matcher.matches( ref.toString() ); } }
); serviceURI = response.getLocationRef().toString();
/** * 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()); } }
if (response.getLocationRef() != null) { final Template rt = new Template(this.targetTemplate); rt.setLogger(getLogger()); final int matched = rt.parse(response.getLocationRef().toString(), request);
this.response.getLocationRef()); } else if (variableName.equals("S")) { if (this.response.getStatus() != null) {
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(); }