本文整理了Java中org.restlet.data.Response.setStatus
方法的一些代码示例,展示了Response.setStatus
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.setStatus
方法的具体详情如下:
包路径:org.restlet.data.Response
类名称:Response
方法名:setStatus
[英]Sets the status.
[中]设置状态。
代码示例来源: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
/**
* 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);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Sets the status.
*
* @param status
* The status to set.
*/
@Override
public void setStatus(Status status) {
getWrappedResponse().setStatus(status);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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));
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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);
}
代码示例来源: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
/**
* 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));
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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));
}
代码示例来源:origin: org.geowebcache/gwc-rest
void writeError(Status status, String message) {
log.error(message);
this.getResponse().setStatus(status, message);
}
代码示例来源:origin: org.geoserver/restconfig
@Override
public void handleDelete() {
if (getTemplateFile().delete()) {
getResponse().setStatus(Status.SUCCESS_OK);
} else {
getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
}
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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);
}
代码示例来源:origin: org.geoserver/restconfig
@Override
public void handlePut() {
doFileUpload();
getResponse().setStatus(Status.SUCCESS_CREATED);
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin
/**
* 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);
}
代码示例来源:origin: org.geowebcache/gwc-rest
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);
}
}
代码示例来源:origin: org.geoserver/restconfig
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);
}
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin
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());
}
内容来源于网络,如有侵权,请联系作者删除!