B - The Http body typepublic interface HttpResponse<B> extends HttpMessage<B>
Common interface for HTTP response implementations.
| Modifier and Type | Method and Description | 
|---|---|
| static <T> MutableHttpResponse<T> | accepted()Return an  HttpStatus.ACCEPTEDresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | accepted(java.net.URI location)Return an  HttpStatus.ACCEPTEDresponse with an empty body and aHttpHeaders.LOCATIONheader. | 
| static <T> MutableHttpResponse<T> | badRequest()Return an  HttpStatus.BAD_REQUESTresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | badRequest(T body)Return an  HttpStatus.BAD_REQUESTresponse with a body. | 
| default B | body() | 
| default int | code() | 
| static <T> MutableHttpResponse<T> | created(T body)Return an  HttpStatus.CREATEDresponse with a body. | 
| static <T> MutableHttpResponse<T> | created(T body,
       java.net.URI location)Return an  HttpStatus.CREATEDresponse with a body and the location of the new resource. | 
| static <T> MutableHttpResponse<T> | created(java.net.URI location)Return an  HttpStatus.CREATEDresponse with the location of the new resource. | 
| HttpStatus | getStatus() | 
| default java.lang.String | header(java.lang.CharSequence name)Return the first value for the given header or null. | 
| static <T> MutableHttpResponse<T> | noContent()Return an  HttpStatus.NO_CONTENTresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | notAllowed(HttpMethod... allowed)Return an  HttpStatus.METHOD_NOT_ALLOWEDresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | notAllowed(java.util.Set<HttpMethod> allowed)Return an  HttpStatus.METHOD_NOT_ALLOWEDresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | notAllowedGeneric(java.util.Set<? extends java.lang.CharSequence> allowed)Return an  HttpStatus.METHOD_NOT_ALLOWEDresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | notFound()Return an  HttpStatus.NOT_FOUNDresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | notFound(T body)Return an  HttpStatus.NOT_FOUNDresponse with a body. | 
| static <T> MutableHttpResponse<T> | notModified()Return an  HttpStatus.NOT_MODIFIEDresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | ok()Return an  HttpStatus.OKresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | ok(T body)Return an  HttpStatus.OKresponse with a body. | 
| static <T> MutableHttpResponse<T> | permanentRedirect(java.net.URI location)Return an  HttpStatus.PERMANENT_REDIRECTresponse with the location of the new resource. | 
| default java.lang.String | reason() | 
| static <T> MutableHttpResponse<T> | redirect(java.net.URI location)Return an  HttpStatus.MOVED_PERMANENTLYresponse with the location of the new resource. | 
| static <T> MutableHttpResponse<T> | seeOther(java.net.URI location)Return an  HttpStatus.SEE_OTHERresponse with the location of the new resource. | 
| static <T> MutableHttpResponse<T> | serverError()Return an  HttpStatus.INTERNAL_SERVER_ERRORresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | serverError(T body)Return an  HttpStatus.INTERNAL_SERVER_ERRORresponse with a body. | 
| default HttpResponse<B> | setAttribute(java.lang.CharSequence name,
            java.lang.Object value)Sets an attribute on the message. | 
| default HttpStatus | status() | 
| static <T> MutableHttpResponse<T> | status(HttpStatus status)Return a response for the given status. | 
| static <T> MutableHttpResponse<T> | status(HttpStatus status,
      java.lang.String reason)Return a response for the given status. | 
| static <T> MutableHttpResponse<T> | temporaryRedirect(java.net.URI location)Return an  HttpStatus.TEMPORARY_REDIRECTresponse with the location of the new resource. | 
| static <T> MutableHttpResponse<T> | unauthorized()Return an  HttpStatus.UNAUTHORIZEDresponse with an empty body. | 
| static <T> MutableHttpResponse<T> | unprocessableEntity()Return an  HttpStatus.UNPROCESSABLE_ENTITYresponse with an empty body. | 
| static java.net.URI | uri(java.lang.CharSequence uri)Helper method for defining URIs. | 
getAttributes, getBody, getBody, getBody, getCharacterEncoding, getContentLength, getContentType, getHeaders, getLocaleremoveAttributegetAttribute, getAttributeHttpStatus getStatus()
default HttpResponse<B> setAttribute(java.lang.CharSequence name, java.lang.Object value)
MutableAttributeHoldersetAttribute in interface HttpMessage<B>setAttribute in interface MutableAttributeHoldername - The name of the attributevalue - The value of the attribute@Nullable
default java.lang.String header(@Nullable
                                          java.lang.CharSequence name)
name - The name@Nullable default B body()
default HttpStatus status()
default int code()
default java.lang.String reason()
static <T> MutableHttpResponse<T> ok()
HttpStatus.OK response with an empty body.T - The response typestatic <T> MutableHttpResponse<T> notFound()
HttpStatus.NOT_FOUND response with an empty body.T - The response typestatic <T> MutableHttpResponse<T> unauthorized()
HttpStatus.UNAUTHORIZED response with an empty body.T - The response typestatic <T> MutableHttpResponse<T> notFound(T body)
HttpStatus.NOT_FOUND response with a body.T - The body typebody - The response bodystatic <T> MutableHttpResponse<T> badRequest()
HttpStatus.BAD_REQUEST response with an empty body.T - The response typestatic <T> MutableHttpResponse<T> badRequest(T body)
HttpStatus.BAD_REQUEST response with a body.T - The body typebody - The response bodystatic <T> MutableHttpResponse<T> unprocessableEntity()
HttpStatus.UNPROCESSABLE_ENTITY response with an empty body.T - The response typestatic <T> MutableHttpResponse<T> notAllowed(HttpMethod... allowed)
HttpStatus.METHOD_NOT_ALLOWED response with an empty body.T - The response typeallowed - Allowed Http Methodsstatic <T> MutableHttpResponse<T> notAllowed(java.util.Set<HttpMethod> allowed)
HttpStatus.METHOD_NOT_ALLOWED response with an empty body.T - The response typeallowed - Allowed Http Methodsstatic <T> MutableHttpResponse<T> notAllowedGeneric(java.util.Set<? extends java.lang.CharSequence> allowed)
HttpStatus.METHOD_NOT_ALLOWED response with an empty body.T - The response typeallowed - Allowed Http Methodsstatic <T> MutableHttpResponse<T> serverError()
HttpStatus.INTERNAL_SERVER_ERROR response with an empty body.T - The response typestatic <T> MutableHttpResponse<T> serverError(T body)
HttpStatus.INTERNAL_SERVER_ERROR response with a body.T - The response typebody - The response bodystatic <T> MutableHttpResponse<T> accepted()
HttpStatus.ACCEPTED response with an empty body.T - The response typestatic <T> MutableHttpResponse<T> accepted(java.net.URI location)
HttpStatus.ACCEPTED response with an empty body and a HttpHeaders.LOCATION header.T - The response typelocation - the location in which the new resource will be availablestatic <T> MutableHttpResponse<T> noContent()
HttpStatus.NO_CONTENT response with an empty body.T - The response typestatic <T> MutableHttpResponse<T> notModified()
HttpStatus.NOT_MODIFIED response with an empty body.T - The response typestatic <T> MutableHttpResponse<T> ok(T body)
HttpStatus.OK response with a body.T - The body typebody - The response bodystatic <T> MutableHttpResponse<T> created(T body)
HttpStatus.CREATED response with a body.T - The body typebody - The response bodystatic <T> MutableHttpResponse<T> created(java.net.URI location)
HttpStatus.CREATED response with the location of the new resource.T - The response typelocation - The location of the new resourcestatic <T> MutableHttpResponse<T> created(T body, java.net.URI location)
HttpStatus.CREATED response with a body and the location of the new resource.T - The body typebody - The response bodylocation - The location of the new resourcestatic <T> MutableHttpResponse<T> seeOther(java.net.URI location)
HttpStatus.SEE_OTHER response with the location of the new resource.T - The response typelocation - The location of the new resourcestatic <T> MutableHttpResponse<T> temporaryRedirect(java.net.URI location)
HttpStatus.TEMPORARY_REDIRECT response with the location of the new resource.T - The response typelocation - The location of the new resourcestatic <T> MutableHttpResponse<T> permanentRedirect(java.net.URI location)
HttpStatus.PERMANENT_REDIRECT response with the location of the new resource.T - The response typelocation - The location of the new resourcestatic <T> MutableHttpResponse<T> redirect(java.net.URI location)
HttpStatus.MOVED_PERMANENTLY response with the location of the new resource.T - The response typelocation - The location of the new resourcestatic <T> MutableHttpResponse<T> status(HttpStatus status)
T - The response typestatus - The statusstatic <T> MutableHttpResponse<T> status(HttpStatus status, java.lang.String reason)
T - The response typestatus - The statusreason - An alternatively reason messagestatic java.net.URI uri(java.lang.CharSequence uri)
uri - The URI char sequence