Package org.apache.juneau.http
Class HttpResponses
java.lang.Object
org.apache.juneau.http.HttpResponses
Static factory methods for creating pre-defined HTTP response and exception objects.
Import statically for clean DSL-style usage in REST server code:
import static HttpResponses.*;
See Also:
- Since:
- 9.2.1
-
Method Summary
Modifier and TypeMethodDescriptionstatic Acceptedaccepted()static BadRequeststatic BadRequestbadRequest(String message) static Conflictconflict()static Conflictstatic Continuestatic Createdcreated()static Createdstatic Forbiddenstatic Forbiddenstatic Foundstatic Gonegone()static InternalServerErrorstatic InternalServerErrorinternalServerError(String message) static InternalServerErrorinternalServerError(Throwable cause) static MethodNotAllowedstatic MovedPermanentlymovedPermanently(String location) static NoContentstatic NotFoundnotFound()static NotFoundstatic NotImplementedstatic NotModifiedstatic Okok()static Okstatic PartialContentstatic PermanentRedirectpermanentRedirect(String location) static PreconditionFailedstatic SeeOtherstatic ServiceUnavailablestatic ServiceUnavailableserviceUnavailable(String message) static SwitchingProtocolsstatic TemporaryRedirecttemporaryRedirect(String location) static TooManyRequestsstatic Unauthorizedstatic Unauthorizedunauthorized(String message) static UnprocessableEntitystatic UnprocessableEntityunprocessableEntity(String message) static UnsupportedMediaTypestatic UnsupportedMediaTypeunsupportedMediaType(String message)
-
Method Details
-
continueResponse
- Returns:
- A new
100 Continueresponse.
-
switchingProtocols
- Returns:
- A new
101 Switching Protocolsresponse.
-
ok
- Returns:
- A new
200 OKresponse.
-
ok
- Parameters:
body- The response body. Can benull for no response body. @return A new200 OKresponse.
-
created
- Returns:
- A new
201 Createdresponse.
-
created
- Parameters:
body- The response body. Can benull for no response body. @return A new201 Createdresponse.
-
accepted
- Returns:
- A new
202 Acceptedresponse.
-
noContent
- Returns:
- A new
204 No Contentresponse.
-
partialContent
- Returns:
- A new
206 Partial Contentresponse.
-
movedPermanently
- Parameters:
location- The redirect location. Can benull to omit theLocationheader. @return A new301 Moved Permanentlyresponse.
-
found
- Parameters:
location- The redirect location. Can benull to omit theLocationheader. @return A new302 Foundresponse.
-
seeOther
- Parameters:
location- The redirect location. Can benull to omit theLocationheader. @return A new303 See Otherresponse.
-
notModified
- Returns:
- A new
304 Not Modifiedresponse.
-
temporaryRedirect
- Parameters:
location- The redirect location. Can benull to omit theLocationheader. @return A new307 Temporary Redirectresponse.
-
permanentRedirect
- Parameters:
location- The redirect location. Can benull to omit theLocationheader. @return A new308 Permanent Redirectresponse.
-
badRequest
- Returns:
- A new
400 Bad Requestexception.
-
badRequest
- Parameters:
message- The error message. Can benull for no message body. @return A new400 Bad Requestexception.
-
unauthorized
- Returns:
- A new
401 Unauthorizedexception.
-
unauthorized
- Parameters:
message- The error message. Can benull for no message body. @return A new401 Unauthorizedexception.
-
forbidden
- Returns:
- A new
403 Forbiddenexception.
-
forbidden
- Parameters:
message- The error message. Can benull for no message body. @return A new403 Forbiddenexception.
-
notFound
- Returns:
- A new
404 Not Foundexception.
-
notFound
- Parameters:
message- The error message. Can benull for no message body. @return A new404 Not Foundexception.
-
methodNotAllowed
- Returns:
- A new
405 Method Not Allowedexception.
-
conflict
- Returns:
- A new
409 Conflictexception.
-
conflict
- Parameters:
message- The error message. Can benull for no message body. @return A new409 Conflictexception.
-
gone
- Returns:
- A new
410 Goneexception.
-
preconditionFailed
- Returns:
- A new
412 Precondition Failedexception.
-
unsupportedMediaType
- Returns:
- A new
415 Unsupported Media Typeexception.
-
unsupportedMediaType
- Parameters:
message- The error message. Can benull for no message body. @return A new415 Unsupported Media Typeexception.
-
unprocessableEntity
- Returns:
- A new
422 Unprocessable Entityexception.
-
unprocessableEntity
- Parameters:
message- The error message. Can benull for no message body. @return A new422 Unprocessable Entityexception.
-
tooManyRequests
- Returns:
- A new
429 Too Many Requestsexception.
-
internalServerError
- Returns:
- A new
500 Internal Server Errorexception.
-
internalServerError
- Parameters:
message- The error message. Can benull for no message body. @return A new500 Internal Server Errorexception.
-
internalServerError
- Parameters:
cause- The cause. Can benull (no cause is chained). @return A new500 Internal Server Errorexception.
-
notImplemented
- Returns:
- A new
501 Not Implementedexception.
-