/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * Sets the reference that the client should follow for redirections or * resource creations. * * @param locationRef * The reference to set. * @see Response#setLocationRef(Reference) */ public void setLocationRef(Reference locationRef) { if (getResponse() != null) { getResponse().setLocationRef(locationRef); } }
/** * 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. * @see Response#setLocationRef(String) */ public void setLocationRef(String locationUri) { if (getResponse() != null) { getResponse().setLocationRef(locationUri); } }
private void post( final Request request, final Response response ) { execute( request, response, resource -> { RestForm form = createRestForm( request ); RestLink link = resource.post( form ); response.setLocationRef( link.path().get() ); response.setStatus( Status.REDIRECTION_SEE_OTHER ); } ); }
response.setLocationRef(targetRef); response.setStatus(Status.REDIRECTION_FOUND); break;
for (Header header : headers) { if (HEADER_LOCATION.equalsIgnoreCase(header.getName())) { response.setLocationRef(header.getValue()); } else if (HEADER_AGE.equalsIgnoreCase(header.getName())) { try {
response.setLocationRef(baseRef.toString() + remainingPart);
.setLocationRef( new Reference( request .getResourceRef() .toString() + "/" ).toString() );
/** * Rewrite the location of the response, and the Location of the entity, if * any. * * @param request * The request to handle. * @param response * The response to update. */ public void rewriteLocation(Request request, Response response) { if (response.getLocationRef() != null) { Reference locationRef = response.getLocationRef(); String newLocation = getLocation(locationRef, request); if (newLocation != null) { response.setLocationRef(newLocation); } } if (response.getEntity() != null && response.getEntity().getLocationRef() != null) { Reference locationRef = response.getEntity().getLocationRef(); String newLocation = getLocation(locationRef, request); if (newLocation != null) { response.getEntity().setLocationRef(newLocation); } } }
/** * 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()}.<br> * <br> * Note that when used with HTTP connectors, this property maps to the * "Location" header. * * @param locationUri * The URI to set. * @see #setLocationRef(Reference) */ 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()); }
Link link = (Link) result; Reference reference = new Reference( response.getRequest().getResourceRef(), link.href().get() ); response.setLocationRef( reference ); return true;
Link link = (Link) result; Reference reference = new Reference( response.getRequest().getResourceRef(), link.href().get() ); response.setLocationRef( reference ); return true;
Link link = (Link) result; Reference reference = new Reference( response.getRequest().getResourceRef(), link.href().get() ); response.setLocationRef( reference ); return true;