/** * 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); }
/** * Handles a PUT call. The default behavior, to be overriden by subclasses, * is to set the status to {@link Status#SERVER_ERROR_INTERNAL}. */ public void handlePut() { getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); }
/** * Sets the status. * * @param status * The status to set. */ @Override public void setStatus(Status status) { getWrappedResponse().setStatus(status); }
/** * Sets the status. * * @param status * The status to set. * @param throwable * The related error or exception. */ public void setStatus(Status status, Throwable throwable) { setStatus(new Status(status, throwable)); }
/** * Sets the status. * * @param status * The status to set. * @param message * The status message. */ @Override public void setStatus(Status status, String message) { getWrappedResponse().setStatus(status, message); }
/** * Handles a GET call. The default behavior, to be overriden by subclasses, * is to set the status to {@link Status#SERVER_ERROR_INTERNAL}. */ public void handleGet() { getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); }
/** * Handles a POST call. The default behavior, to be overriden by subclasses, * is to set the status to {@link Status#SERVER_ERROR_INTERNAL}. */ public void handlePost() { getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); }
/** * Handles a DELETE call. The default behavior, to be overriden by * subclasses, is to set the status to {@link Status#SERVER_ERROR_INTERNAL}. */ public void handleDelete() { getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); }
/** * Removes all the representations of the resource and effectively the * resource itself. The default behavior is to set the response status to * {@link Status#SERVER_ERROR_INTERNAL}.<br> * <br> * This is the higher-level method that let you process DELETE requests. */ public void removeRepresentations() throws ResourceException { getResponse().setStatus(Status.SERVER_ERROR_INTERNAL); }
/** * 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); }
/** * Sets the status. * * @param status * The status to set. * @param message * The status message. */ public void setStatus(Status status, String message) { setStatus(new Status(status, message)); }
/** * Sets the status. * * @param status * The status to set. * @param throwable * The related error or exception. * @param message * The status message. */ public void setStatus(Status status, Throwable throwable, String message) { setStatus(new Status(status, throwable, message)); }
void writeError(Status status, String message) { log.error(message); this.getResponse().setStatus(status, message); }
/** * Handles an OPTIONS call introspecting the target resource (as provided by * the 'findTarget' method). The default implementation is based on the HTTP * specification which says that OPTIONS should return the list of allowed * methods in the Response headers. */ public void handleOptions() { updateAllowedMethods(); getResponse().setStatus(Status.SUCCESS_OK); }
@Override public void handlePut() { doFileUpload(); getResponse().setStatus(Status.SUCCESS_CREATED); }
/** * Empty the wastebasket. */ @Override @DELETE @ResourceMethodSignature() public void delete(Context context, Request request, Response response) throws ResourceException { EmptyTrashTask task = nexusScheduler.createTaskInstance(EmptyTrashTask.class); nexusScheduler.submit("Internal", task); response.setStatus(Status.SUCCESS_NO_CONTENT); }
public void handle(Request request, Response response) { if (request.getMethod().equals(Method.GET)) { doGet(request, response); } else { response.setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED); } }
private File doFileUpload() { try { getResponse().setStatus(Status.SUCCESS_ACCEPTED); File directory = catalog.getResourceLoader().findOrCreateDirectory(getDirectoryPath(getRequest())); if (LOGGER.isLoggable(Level.INFO)) { MediaType mediaType = getRequest().getEntity().getMediaType(); LOGGER.info("PUT file: mimetype=" + mediaType + ", path=" + directory.getAbsolutePath()); } return RESTUtils.handleBinUpload(getAttribute("template") + "." + MEDIATYPE_FTL_EXTENSION, directory, false, getRequest()); } catch (IOException e) { throw new RestletException(e.getMessage(), Status.SERVER_ERROR_INTERNAL, e); } }
public String getRestRepoRemoteStatus(ProxyRepository repository, Request request, Response response) throws ResourceException { Form form = request.getResourceRef().getQueryAsForm(); boolean forceCheck = form.getFirst("forceCheck") != null; RemoteStatus rs = repository.getRemoteStatus(new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT), forceCheck); if (RemoteStatus.UNKNOWN.equals(rs)) { // set status to ACCEPTED, since we have incomplete info response.setStatus(Status.SUCCESS_ACCEPTED); } return rs == null ? null : rs.toString() + (rs.getReason() == null ? "" : ":" + rs.getReason()); }