public class HttpStatusSetter
extends java.lang.Object
Constructor | Description |
---|---|
HttpStatusSetter() |
Modifier and Type | Method | Description |
---|---|---|
static void |
accepted(Translet translet) |
202 Accepted . |
static void |
badRequest(Translet translet) |
400 Bad Request . |
static void |
conflict(Translet translet) |
409 Conflict . |
static void |
created(Translet translet) |
201 Created . |
static void |
created(Translet translet,
java.lang.String location) |
201 Created . |
static void |
forbidden(Translet translet) |
403 Forbidden . |
static void |
internalServerError(Translet translet) |
500 Internal Server Error . |
static void |
methodNotAllowed(Translet translet) |
405 Method Not Allowed . |
static void |
movedPermanently(Translet translet) |
301 Moved Permanently . |
static void |
noContent(Translet translet) |
204 No Content . |
static void |
notAcceptable(Translet translet) |
406 Not Acceptable . |
static void |
notFound(Translet translet) |
404 Not Found . |
static void |
notModified(Translet translet) |
304 Not Modified . |
static void |
ok(Translet translet) |
200 OK . |
static void |
preconditionFailed(Translet translet) |
412 Precondition failed . |
static void |
seeOther(Translet translet) |
303 See Other . |
static void |
setStatus(int statusCode,
Translet translet) |
Sets the status code.
|
static void |
setStatus(HttpStatus httpStatus,
Translet translet) |
Sets the status code.
|
static void |
temporaryRedirect(Translet translet) |
307 Temporary Redirect . |
static void |
unauthorized(Translet translet) |
401 Unauthorized . |
static void |
unsupportedMediaType(Translet translet) |
415 Unsupported Media Type . |
public static void setStatus(HttpStatus httpStatus, Translet translet)
httpStatus
- the http status codetranslet
- the Transletpublic static void setStatus(int statusCode, Translet translet)
statusCode
- the http status codetranslet
- the Transletpublic static void ok(Translet translet)
200 OK
.
The request has succeeded.
The information returned with the response is dependent on
the method used in the request, for example:
translet
- the Transletpublic static void created(Translet translet)
201 Created
.
The request has succeeded and a new resource has been created as a result of it.
This is typically the response sent after a PUT request.translet
- the Transletpublic static void created(Translet translet, java.lang.String location)
201 Created
.
The request has succeeded and a new resource has been created as a result of it.
This is typically the response sent after a PUT request.
The newly created resource can be referenced by the URI(s) returned in the entity
of the response,with the most specific URI for the resource given by
a Location header field.translet
- the Transletlocation
- a location header set to the given URIpublic static void accepted(Translet translet)
202 Accepted
.
The request has been received but not yet acted upon.
It is non-committal, meaning that there is no way in HTTP to later send
an asynchronous response indicating the outcome of processing the request.
It is intended for cases where another process or server handles the request,
or for batch processing.translet
- the Transletpublic static void noContent(Translet translet)
204 No Content
.
The server successfully processed the request and is not returning any content.
The 204 response MUST NOT include a message-body, and thus is always terminated
by the first empty line after the header fields.translet
- the Transletpublic static void movedPermanently(Translet translet)
301 Moved Permanently
.
This response code means that URI of requested resource has been changed.
Any future references to this resource SHOULD use one of the returned URIs.translet
- the Transletpublic static void seeOther(Translet translet)
303 See Other
.
The response to the request can be found under a different URI and 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.
The 303 response MUST NOT be cached, but the response to the second (redirected)
request might be cacheable.translet
- the Transletpublic static void notModified(Translet translet)
304 Not Modified
.
This is used for caching purposes.
It is telling to client that response has not been modified.
So, client can continue to use same cached version of response.translet
- the Transletpublic static void temporaryRedirect(Translet translet)
307 Temporary Redirect
.
The target resource resides temporarily under a different URI and the user agent
MUST NOT change the request method if it performs an automatic redirection to that URI.translet
- the Transletpublic static void badRequest(Translet translet)
400 Bad Request
.
The server cannot or will not process the request due to something that is perceived
to be a client error (e.g., malformed request syntax, invalid request message framing,
or deceptive request routing).translet
- the Transletpublic static void unauthorized(Translet translet)
401 Unauthorized
.
The request was a legal request, but the server is refusing to respond to it.
For use when authentication is possible but has failed or not yet been provided.translet
- the Transletpublic static void forbidden(Translet translet)
403 Forbidden
.
The request was a legal request, but the server is refusing to respond to it.translet
- the Transletpublic static void notFound(Translet translet)
404 Not Found
.
The server has not found anything matching the Request-URI.
The requested resource could not be found but may be available again
in the future. Subsequent requests by the client are permissible.translet
- the Transletpublic static void methodNotAllowed(Translet translet)
405 Method Not Allowed
.
The request method is known by the server but has been disabled
and cannot be used. The two mandatory methods, GET and HEAD,
must never be disabled and should not return this error code.translet
- the Transletpublic static void notAcceptable(Translet translet)
406 Not Acceptable
.
The requested resource is capable of generating only content not
acceptable according to the Accept headers sent in the request.translet
- the Transletpublic static void conflict(Translet translet)
409 Conflict
.
The request could not be completed because of a conflict.translet
- the Transletpublic static void preconditionFailed(Translet translet)
412 Precondition failed
.
The server does not meet one of the preconditions that
the requester put on the request.translet
- the Transletpublic static void unsupportedMediaType(Translet translet)
415 Unsupported Media Type
.
The server is refusing to service the request because
the entity of the request is in a format not supported by
the requested resource for the requested method.translet
- the Transletpublic static void internalServerError(Translet translet)
500 Internal Server Error
.
The server encountered an unexpected condition which
prevented it from fulfilling the request.translet
- the TransletCopyright © 2008–2018 The Aspectran Project. All rights reserved.