- All Superinterfaces:
ServletResponse
- All Known Subinterfaces:
WebApplicationResponse
- All Known Implementing Classes:
DefaultWebApplicationResponse
,EmbeddedResponse
,HttpServletResponseWrapper
,HttpWebApplicationResponse
,NanoResponse
The HttpServletResponse API.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
Defines the 202 status code.static int
Defines the 502 status code.static int
Defines the 400 status code.static int
Defines the 409 status code.static int
Defines the 100 status code.static int
Defines the 201 status code.static int
Defines the 417 status code.static int
Defines the 403 status code.static int
Defines the 302 status code (recommended variant).static int
Defines the 504 status code.static int
Defines the 410 status code.static int
Defines the 505 status code.static int
Defines the 500 status code.static int
Defines the 411 status code.static int
Defines the 405 status code.static int
Defines the 301 status code.static int
Defines the 302 status code.static int
Defines the 300 status code.static int
Defines the 204 status code.static int
Defines the 203 status code.static int
Defines the 406 status code.static int
Defines the 404 status code.static int
Defines the 501 status code.static int
Defines the 305 status code.static int
Defines the 200 status code.static int
Defines the 206 status code.static int
Defines the 402 status code.static int
Defines the 412 status code.static int
Defines the 407 status code.static int
Defines the 413 status code.static int
Defines the 408 status code.static int
Defines the 414 status code.static int
Defines the 416 status code.static int
Defines the 205 status code.static int
Defines the 303 status code.static int
Defines the 503 status code.static int
Defines the 101 status code.static int
Defines the 307 status code.static int
Defines the 401 status code.static int
Defines the 415 status code.static int
Defines the 305 status code. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the cookie.void
addDateHeader(String name, long date)
Add the date header.void
Add the header.void
addIntHeader(String name, int value)
Add the intheader.boolean
containsHeader(String name)
Contains the header.encodeRedirectUrl(String url)
Deprecated.encodeRedirectURL(String url)
Encode the redirect URL.Deprecated.Encode the URL.Get the header.Returns the header names.getHeaders(String name)
Returns the headers.int
Returns the status.Returns the supplier of trailer fields.void
sendError(int status)
Sends the error.void
Send the error.void
sendRedirect(String location)
Send a redirect.void
setDateHeader(String name, long date)
Set the date header.void
Set the header.void
setIntHeader(String name, int value)
Set the int header.void
setStatus(int status)
Set the status.void
Deprecated.default void
setTrailerFields(Supplier<Map<String,String>> supplier)
Set the trailer fields supplier.Methods inherited from interface jakarta.servlet.ServletResponse
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentLengthLong, setContentType, setLocale
-
Field Details
-
SC_CONTINUE
static final int SC_CONTINUEDefines the 100 status code.- See Also:
- Constant Field Values
-
SC_SWITCHING_PROTOCOLS
static final int SC_SWITCHING_PROTOCOLSDefines the 101 status code.- See Also:
- Constant Field Values
-
SC_OK
static final int SC_OKDefines the 200 status code.- See Also:
- Constant Field Values
-
SC_CREATED
static final int SC_CREATEDDefines the 201 status code.- See Also:
- Constant Field Values
-
SC_ACCEPTED
static final int SC_ACCEPTEDDefines the 202 status code.- See Also:
- Constant Field Values
-
SC_NON_AUTHORITATIVE_INFORMATION
static final int SC_NON_AUTHORITATIVE_INFORMATIONDefines the 203 status code.- See Also:
- Constant Field Values
-
SC_NO_CONTENT
static final int SC_NO_CONTENTDefines the 204 status code.- See Also:
- Constant Field Values
-
SC_RESET_CONTENT
static final int SC_RESET_CONTENTDefines the 205 status code.- See Also:
- Constant Field Values
-
SC_PARTIAL_CONTENT
static final int SC_PARTIAL_CONTENTDefines the 206 status code.- See Also:
- Constant Field Values
-
SC_MULTIPLE_CHOICES
static final int SC_MULTIPLE_CHOICESDefines the 300 status code.- See Also:
- Constant Field Values
-
SC_MOVED_PERMANENTLY
static final int SC_MOVED_PERMANENTLYDefines the 301 status code.- See Also:
- Constant Field Values
-
SC_MOVED_TEMPORARILY
static final int SC_MOVED_TEMPORARILYDefines the 302 status code.- See Also:
- Constant Field Values
-
SC_FOUND
static final int SC_FOUNDDefines the 302 status code (recommended variant).- See Also:
- Constant Field Values
-
SC_SEE_OTHER
static final int SC_SEE_OTHERDefines the 303 status code.- See Also:
- Constant Field Values
-
SC_NOT_MODIFIED
static final int SC_NOT_MODIFIEDDefines the 305 status code.- See Also:
- Constant Field Values
-
SC_USE_PROXY
static final int SC_USE_PROXYDefines the 305 status code.- See Also:
- Constant Field Values
-
SC_TEMPORARY_REDIRECT
static final int SC_TEMPORARY_REDIRECTDefines the 307 status code.- See Also:
- Constant Field Values
-
SC_BAD_REQUEST
static final int SC_BAD_REQUESTDefines the 400 status code.- See Also:
- Constant Field Values
-
SC_UNAUTHORIZED
static final int SC_UNAUTHORIZEDDefines the 401 status code.- See Also:
- Constant Field Values
-
SC_PAYMENT_REQUIRED
static final int SC_PAYMENT_REQUIREDDefines the 402 status code.- See Also:
- Constant Field Values
-
SC_FORBIDDEN
static final int SC_FORBIDDENDefines the 403 status code.- See Also:
- Constant Field Values
-
SC_NOT_FOUND
static final int SC_NOT_FOUNDDefines the 404 status code.- See Also:
- Constant Field Values
-
SC_METHOD_NOT_ALLOWED
static final int SC_METHOD_NOT_ALLOWEDDefines the 405 status code.- See Also:
- Constant Field Values
-
SC_NOT_ACCEPTABLE
static final int SC_NOT_ACCEPTABLEDefines the 406 status code.- See Also:
- Constant Field Values
-
SC_PROXY_AUTHENTICATION_REQUIRED
static final int SC_PROXY_AUTHENTICATION_REQUIREDDefines the 407 status code.- See Also:
- Constant Field Values
-
SC_REQUEST_TIMEOUT
static final int SC_REQUEST_TIMEOUTDefines the 408 status code.- See Also:
- Constant Field Values
-
SC_CONFLICT
static final int SC_CONFLICTDefines the 409 status code.- See Also:
- Constant Field Values
-
SC_GONE
static final int SC_GONEDefines the 410 status code.- See Also:
- Constant Field Values
-
SC_LENGTH_REQUIRED
static final int SC_LENGTH_REQUIREDDefines the 411 status code.- See Also:
- Constant Field Values
-
SC_PRECONDITION_FAILED
static final int SC_PRECONDITION_FAILEDDefines the 412 status code.- See Also:
- Constant Field Values
-
SC_REQUEST_ENTITY_TOO_LARGE
static final int SC_REQUEST_ENTITY_TOO_LARGEDefines the 413 status code.- See Also:
- Constant Field Values
-
SC_REQUEST_URI_TOO_LONG
static final int SC_REQUEST_URI_TOO_LONGDefines the 414 status code.- See Also:
- Constant Field Values
-
SC_UNSUPPORTED_MEDIA_TYPE
static final int SC_UNSUPPORTED_MEDIA_TYPEDefines the 415 status code.- See Also:
- Constant Field Values
-
SC_REQUESTED_RANGE_NOT_SATISFIABLE
static final int SC_REQUESTED_RANGE_NOT_SATISFIABLEDefines the 416 status code.- See Also:
- Constant Field Values
-
SC_EXPECTATION_FAILED
static final int SC_EXPECTATION_FAILEDDefines the 417 status code.- See Also:
- Constant Field Values
-
SC_INTERNAL_SERVER_ERROR
static final int SC_INTERNAL_SERVER_ERRORDefines the 500 status code.- See Also:
- Constant Field Values
-
SC_NOT_IMPLEMENTED
static final int SC_NOT_IMPLEMENTEDDefines the 501 status code.- See Also:
- Constant Field Values
-
SC_BAD_GATEWAY
static final int SC_BAD_GATEWAYDefines the 502 status code.- See Also:
- Constant Field Values
-
SC_SERVICE_UNAVAILABLE
static final int SC_SERVICE_UNAVAILABLEDefines the 503 status code.- See Also:
- Constant Field Values
-
SC_GATEWAY_TIMEOUT
static final int SC_GATEWAY_TIMEOUTDefines the 504 status code.- See Also:
- Constant Field Values
-
SC_HTTP_VERSION_NOT_SUPPORTED
static final int SC_HTTP_VERSION_NOT_SUPPORTEDDefines the 505 status code.- See Also:
- Constant Field Values
-
-
Method Details
-
addCookie
Adds the cookie.- Parameters:
cookie
- the cookie.
-
addDateHeader
Add the date header.- Parameters:
name
- the name.date
- the date.
-
addHeader
Add the header.- Parameters:
name
- the name.value
- the value.
-
addIntHeader
Add the intheader.- Parameters:
name
- the name.value
- the value.
-
containsHeader
Contains the header.- Parameters:
name
- the name.- Returns:
- true if it contains the given header, false otherwise.
-
encodeRedirectURL
Encode the redirect URL.- Parameters:
url
- the redirect URL.- Returns:
- the encoded redirect URL.
-
encodeRedirectUrl
Deprecated.Encode the redirect URL.- Parameters:
url
- the redirect URL.- Returns:
- the encoded redirect URL.
-
encodeURL
Encode the URL.- Parameters:
url
- the URL.- Returns:
- the encoded URL.
-
encodeUrl
Deprecated.Encode the URL.- Parameters:
url
- the URL.- Returns:
- the encoded URL.
-
getHeader
Get the header.- Parameters:
name
- the name.- Returns:
- the value, or null if not found.
-
getHeaderNames
Collection<String> getHeaderNames()Returns the header names.- Returns:
- the header names
-
getHeaders
Returns the headers.- Parameters:
name
- the name.- Returns:
- the headers
-
getStatus
int getStatus()Returns the status.- Returns:
- the status
-
getTrailerFields
Returns the supplier of trailer fields.- Returns:
- the supplier of trailer fields
-
sendError
Send the error.- Parameters:
status
- the status code.message
- the message.- Throws:
IOException
- when an I/O error occurs.
-
sendError
Sends the error.- Parameters:
status
- the status code.- Throws:
IOException
- when an I/O error occurs.
-
sendRedirect
Send a redirect.- Parameters:
location
- the location.- Throws:
IOException
- when an I/O error occurs.
-
setDateHeader
Set the date header.- Parameters:
name
- the name.date
- the date.
-
setHeader
Set the header.- Parameters:
name
- the name.value
- the value.
-
setIntHeader
Set the int header.- Parameters:
name
- the name.value
- the value.
-
setStatus
void setStatus(int status)Set the status.- Parameters:
status
- the status.
-
setStatus
Deprecated.Set the status.- Parameters:
status
- the status.message
- the message.
-
setTrailerFields
Set the trailer fields supplier.- Parameters:
supplier
- the trailer fields supplier.
-