Package com.aspectran.web.support.http
Class HttpStatusSetter
java.lang.Object
com.aspectran.web.support.http.HttpStatusSetter
HTTP Status Codes for REST.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
202 Accepted
.static void
badRequest
(Translet translet) 400 Bad Request
.static void
409 Conflict
.static void
201 Created
.static void
201 Created
.static void
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
204 No Content
.static void
notAcceptable
(Translet translet) 406 Not Acceptable
.static void
404 Not Found
.static void
notModified
(Translet translet) 304 Not Modified
.static void
200 OK
.static void
preconditionFailed
(Translet translet) 412 Precondition failed
.static void
303 See Other
.static void
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
.
-
Constructor Details
-
HttpStatusSetter
public HttpStatusSetter()
-
-
Method Details
-
setStatus
Sets the status code.- Parameters:
httpStatus
- the http status codetranslet
- the Translet instance
-
setStatus
Sets the status code.- Parameters:
statusCode
- the http status codetranslet
- the Translet instance
-
ok
200 OK
. The request has succeeded. The information returned with the response is dependent on the method used in the request, for example:- GET an entity corresponding to the requested resource is sent in the response;
- HEAD the entity-header fields corresponding to the requested resource are sent in the response without any message-body;
- POST an entity describing or containing the result of the action;
- TRACE an entity containing the request message as received by the end server.
- Parameters:
translet
- the Translet instance
-
created
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.- Parameters:
translet
- the Translet instance
-
created
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.- Parameters:
translet
- the Translet instancelocation
- a location header set to the given URI
-
accepted
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.- Parameters:
translet
- the Translet instance
-
noContent
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.- Parameters:
translet
- the Translet instance
-
movedPermanently
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.- Parameters:
translet
- the Translet instance
-
seeOther
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.- Parameters:
translet
- the Translet instance
-
notModified
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.- Parameters:
translet
- the Translet instance
-
temporaryRedirect
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.- Parameters:
translet
- the Translet instance
-
badRequest
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).- Parameters:
translet
- the Translet instance
-
unauthorized
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.- Parameters:
translet
- the Translet instance
-
forbidden
403 Forbidden
. The request was a legal request, but the server is refusing to respond to it.- Parameters:
translet
- the Translet instance
-
notFound
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.- Parameters:
translet
- the Translet instance
-
methodNotAllowed
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.- Parameters:
translet
- the Translet instance
-
notAcceptable
406 Not Acceptable
. The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.- Parameters:
translet
- the Translet instance
-
conflict
409 Conflict
. The request could not be completed because of a conflict.- Parameters:
translet
- the Translet instance
-
preconditionFailed
412 Precondition failed
. The server does not meet one of the preconditions that the requester put on the request.- Parameters:
translet
- the Translet instance
-
unsupportedMediaType
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.- Parameters:
translet
- the Translet instance
-
internalServerError
500 Internal Server Error
. The server encountered an unexpected condition which prevented it from fulfilling the request.- Parameters:
translet
- the Translet instance
-