java.lang.Object
cloud.piranha.core.impl.DefaultWebApplicationResponse
- All Implemented Interfaces:
WebApplicationResponse
,jakarta.servlet.http.HttpServletResponse
,jakarta.servlet.ServletResponse
- Direct Known Subclasses:
EmbeddedResponse
,HttpWebApplicationResponse
The default WebApplicationResponse.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Stores the body only flag.protected boolean
Stores the buffer resetting flag.protected String
Stores the character encoding.protected boolean
Stores if the character encoding was set using setLocale.protected boolean
Stores if the character encoding has been set manually.protected boolean
Stores the committed flag.protected String
Stores the content languageprotected long
Stores the content length.protected String
Stores the content type.protected boolean
Stores if the content type has been set manually.protected List<jakarta.servlet.http.Cookie>
Stores the cookies.protected boolean
Stores if we acquired the output stream.protected boolean
Stores if we acquired the writer.protected DefaultHttpHeaderManager
Stores the header manager.protected Locale
Stores the locale.protected Runnable
Stores the response closer.protected int
Stores the status code.protected String
Stores the status message.Stores the trailer fields supplier.protected WebApplication
Stores the web application.protected WebApplicationOutputStream
Stores the web application output stream.protected PrintWriter
Stores the writer.Fields inherited from interface jakarta.servlet.http.HttpServletResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCookie
(jakarta.servlet.http.Cookie cookie) void
addDateHeader
(String name, long date) void
void
addIntHeader
(String name, int value) void
Close the async response.boolean
containsHeader
(String name) encodeRedirectURL
(String url) void
int
Get the content language.Collection<jakarta.servlet.http.Cookie>
Returns the cookies.getHeaders
(String name) jakarta.servlet.ServletOutputStream
Returns the response closer.int
Get the status message.Get the web application.Returns the web application output stream.boolean
Are we in body only mode.boolean
Is the buffer resetting.boolean
void
reset()
void
void
sendError
(int status) void
void
sendRedirect
(String location) void
setBodyOnly
(boolean bodyOnly) Set the body only mode.void
setBufferSize
(int bufferSize) void
setCharacterEncoding
(String characterEncoding) void
setCommitted
(boolean committed) Set the committed.void
setContentLength
(int contentLength) void
setContentLengthLong
(long contentLength) void
setContentType
(String type) void
setDateHeader
(String name, long date) void
void
setIntHeader
(String name, int value) void
void
setResponseCloser
(Runnable responseCloser) Set the response closer.void
setStatus
(int status) void
setTrailerFields
(Supplier<Map<String, String>> trailerFields) void
setWebApplication
(WebApplication webApplication) Set the web application.void
setWebApplicationOutputStream
(WebApplicationOutputStream outputStream) Set the web application output stream.protected void
verifyNotCommitted
(String methodName) Verify we are not committed.
-
Field Details
-
bodyOnly
protected boolean bodyOnlyStores the body only flag. -
bufferResetting
protected boolean bufferResettingStores the buffer resetting flag. -
characterEncoding
Stores the character encoding. -
characterEncodingLocaleSet
protected boolean characterEncodingLocaleSetStores if the character encoding was set using setLocale. -
characterEncodingSet
protected boolean characterEncodingSetStores if the character encoding has been set manually. -
committed
protected boolean committedStores the committed flag. -
contentLanguage
Stores the content language -
contentLength
protected long contentLengthStores the content length. -
contentType
Stores the content type. -
contentTypeSet
protected boolean contentTypeSetStores if the content type has been set manually. -
cookies
Stores the cookies. -
gotOutput
protected boolean gotOutputStores if we acquired the output stream. -
gotWriter
protected boolean gotWriterStores if we acquired the writer. -
headerManager
Stores the header manager. -
locale
Stores the locale. -
responseCloser
Stores the response closer. -
status
protected int statusStores the status code. -
statusMessage
Stores the status message. -
trailerFields
Stores the trailer fields supplier. -
webApplication
Stores the web application. -
webApplicationOutputStream
Stores the web application output stream. -
writer
Stores the writer.
-
-
Constructor Details
-
DefaultWebApplicationResponse
public DefaultWebApplicationResponse()Constructor.
-
-
Method Details
-
addCookie
public void addCookie(jakarta.servlet.http.Cookie cookie) - Specified by:
addCookie
in interfacejakarta.servlet.http.HttpServletResponse
-
addDateHeader
- Specified by:
addDateHeader
in interfacejakarta.servlet.http.HttpServletResponse
-
addHeader
- Specified by:
addHeader
in interfacejakarta.servlet.http.HttpServletResponse
-
addIntHeader
- Specified by:
addIntHeader
in interfacejakarta.servlet.http.HttpServletResponse
-
closeAsyncResponse
public void closeAsyncResponse()Description copied from interface:WebApplicationResponse
Close the async response.- Specified by:
closeAsyncResponse
in interfaceWebApplicationResponse
-
containsHeader
- Specified by:
containsHeader
in interfacejakarta.servlet.http.HttpServletResponse
-
encodeRedirectURL
- Specified by:
encodeRedirectURL
in interfacejakarta.servlet.http.HttpServletResponse
-
encodeURL
- Specified by:
encodeURL
in interfacejakarta.servlet.http.HttpServletResponse
-
flushBuffer
- Specified by:
flushBuffer
in interfacejakarta.servlet.ServletResponse
- Throws:
IOException
-
getBufferSize
public int getBufferSize()- Specified by:
getBufferSize
in interfacejakarta.servlet.ServletResponse
-
getCharacterEncoding
- Specified by:
getCharacterEncoding
in interfacejakarta.servlet.ServletResponse
-
getContentLanguage
Description copied from interface:WebApplicationResponse
Get the content language.- Specified by:
getContentLanguage
in interfaceWebApplicationResponse
- Returns:
- the content language.
-
getContentType
- Specified by:
getContentType
in interfacejakarta.servlet.ServletResponse
-
getCookies
Description copied from interface:WebApplicationResponse
Returns the cookies.- Specified by:
getCookies
in interfaceWebApplicationResponse
- Returns:
- the cookies
-
getHeader
- Specified by:
getHeader
in interfacejakarta.servlet.http.HttpServletResponse
-
getHeaderNames
- Specified by:
getHeaderNames
in interfacejakarta.servlet.http.HttpServletResponse
-
getHeaders
- Specified by:
getHeaders
in interfacejakarta.servlet.http.HttpServletResponse
-
getLocale
- Specified by:
getLocale
in interfacejakarta.servlet.ServletResponse
-
getOutputStream
- Specified by:
getOutputStream
in interfacejakarta.servlet.ServletResponse
- Throws:
IOException
-
getResponseCloser
Description copied from interface:WebApplicationResponse
Returns the response closer.- Specified by:
getResponseCloser
in interfaceWebApplicationResponse
- Returns:
- the response closer
-
getStatus
public int getStatus()- Specified by:
getStatus
in interfacejakarta.servlet.http.HttpServletResponse
-
getStatusMessage
Description copied from interface:WebApplicationResponse
Get the status message.- Specified by:
getStatusMessage
in interfaceWebApplicationResponse
- Returns:
- the status message.
-
getTrailerFields
- Specified by:
getTrailerFields
in interfacejakarta.servlet.http.HttpServletResponse
-
getWebApplication
Description copied from interface:WebApplicationResponse
Get the web application.- Specified by:
getWebApplication
in interfaceWebApplicationResponse
- Returns:
- the web application.
-
getWebApplicationOutputStream
Description copied from interface:WebApplicationResponse
Returns the web application output stream.- Specified by:
getWebApplicationOutputStream
in interfaceWebApplicationResponse
- Returns:
- the web application output stream
-
getWriter
- Specified by:
getWriter
in interfacejakarta.servlet.ServletResponse
- Throws:
IOException
-
isBodyOnly
public boolean isBodyOnly()Description copied from interface:WebApplicationResponse
Are we in body only mode.- Specified by:
isBodyOnly
in interfaceWebApplicationResponse
- Returns:
- true if we are only sending the body, false otherwise.
-
isBufferResetting
public boolean isBufferResetting()Description copied from interface:WebApplicationResponse
Is the buffer resetting.- Specified by:
isBufferResetting
in interfaceWebApplicationResponse
- Returns:
- true if it is, false otherwise.
-
isCommitted
public boolean isCommitted()- Specified by:
isCommitted
in interfacejakarta.servlet.ServletResponse
-
reset
public void reset()- Specified by:
reset
in interfacejakarta.servlet.ServletResponse
-
resetBuffer
public void resetBuffer()- Specified by:
resetBuffer
in interfacejakarta.servlet.ServletResponse
-
sendError
- Specified by:
sendError
in interfacejakarta.servlet.http.HttpServletResponse
- Throws:
IOException
-
sendError
- Specified by:
sendError
in interfacejakarta.servlet.http.HttpServletResponse
- Throws:
IOException
-
sendRedirect
- Specified by:
sendRedirect
in interfacejakarta.servlet.http.HttpServletResponse
- Throws:
IOException
-
setBodyOnly
public void setBodyOnly(boolean bodyOnly) Description copied from interface:WebApplicationResponse
Set the body only mode.- Specified by:
setBodyOnly
in interfaceWebApplicationResponse
- Parameters:
bodyOnly
- the body only mode.
-
setBufferSize
public void setBufferSize(int bufferSize) - Specified by:
setBufferSize
in interfacejakarta.servlet.ServletResponse
-
setCharacterEncoding
- Specified by:
setCharacterEncoding
in interfacejakarta.servlet.ServletResponse
-
setCommitted
public void setCommitted(boolean committed) Set the committed.- Specified by:
setCommitted
in interfaceWebApplicationResponse
- Parameters:
committed
- the committed flag.
-
setContentLength
public void setContentLength(int contentLength) - Specified by:
setContentLength
in interfacejakarta.servlet.ServletResponse
-
setContentLengthLong
public void setContentLengthLong(long contentLength) - Specified by:
setContentLengthLong
in interfacejakarta.servlet.ServletResponse
-
setContentType
- Specified by:
setContentType
in interfacejakarta.servlet.ServletResponse
-
setDateHeader
- Specified by:
setDateHeader
in interfacejakarta.servlet.http.HttpServletResponse
-
setHeader
- Specified by:
setHeader
in interfacejakarta.servlet.http.HttpServletResponse
-
setIntHeader
- Specified by:
setIntHeader
in interfacejakarta.servlet.http.HttpServletResponse
-
setLocale
- Specified by:
setLocale
in interfacejakarta.servlet.ServletResponse
-
setResponseCloser
Description copied from interface:WebApplicationResponse
Set the response closer.- Specified by:
setResponseCloser
in interfaceWebApplicationResponse
- Parameters:
responseCloser
- the response closer.
-
setStatus
public void setStatus(int status) - Specified by:
setStatus
in interfacejakarta.servlet.http.HttpServletResponse
-
setTrailerFields
- Specified by:
setTrailerFields
in interfacejakarta.servlet.http.HttpServletResponse
-
setWebApplication
Description copied from interface:WebApplicationResponse
Set the web application.- Specified by:
setWebApplication
in interfaceWebApplicationResponse
- Parameters:
webApplication
- the web application.
-
setWebApplicationOutputStream
Description copied from interface:WebApplicationResponse
Set the web application output stream.- Specified by:
setWebApplicationOutputStream
in interfaceWebApplicationResponse
- Parameters:
outputStream
- the web application output stream.
-
verifyNotCommitted
Verify we are not committed.- Parameters:
methodName
- the method we are checking for.
-