Class StoredResponse
java.lang.Object
jakarta.servlet.ServletResponseWrapper
jakarta.servlet.http.HttpServletResponseWrapper
com.ibm.websphere.servlet.response.StoredResponse
- All Implemented Interfaces:
StoredResponseCompat<CollectionEnumerationHybrid<String>>
,IExtendedResponse
,ServletResponseExtended
,com.ibm.wsspi.webcontainer.util.IOutputStreamObserver
,com.ibm.wsspi.webcontainer.util.IResponseOutput
,Serializable
,jakarta.servlet.http.HttpServletResponse
,jakarta.servlet.ServletResponse
- Direct Known Subclasses:
ChainedResponse
public class StoredResponse
extends jakarta.servlet.http.HttpServletResponseWrapper
implements StoredResponseCompat<CollectionEnumerationHybrid<String>>, jakarta.servlet.http.HttpServletResponse, Serializable, com.ibm.wsspi.webcontainer.util.IResponseOutput, IExtendedResponse, com.ibm.wsspi.webcontainer.util.IOutputStreamObserver
StoredResponse is a response object that can be instantiated
by any servlet and used/passed as a standard HttpResponse. The
data that is written to this response will be stored for later use.
- See Also:
-
Field Summary
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
ConstructorDescriptionStoredResponse
(boolean isInclude) StoredResponse
(ServletResponseExtended extResponse, boolean isInclude) -
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
addSessionCookie
(jakarta.servlet.http.Cookie cookie) void
void
void
void
void
buildResponseData
(ServletResponseExtended response) void
buildWriterData
(ServletResponseExtended response) void
close()
void
closeResponseOutput
(boolean b) boolean
Returns true if sendError() was called on this response.boolean
containsHeader
(String name) void
destroy()
encodeRedirectUrl
(String url) encodeRedirectURL
(String url) void
finish()
void
fireOutputStreamRetrievedEvent
(jakarta.servlet.ServletOutputStream sos) void
void
void
flushBuffer
(boolean flushToWire) Retrieve only the headers set in the includeint
List<com.ibm.wsspi.bytebuffer.WsByteBuffer>
Return the character encoding as specified in the charset flag of the content-type.jakarta.servlet.http.Cookie[]
Return the cookies that were set using the addCookie() method.long
getDateHeader
(String name) Retrieve a response header as a date.com.ibm.websphere.servlet.error.ServletErrorReport
getError()
Returns the error message as reported by the sendError() method.int
Returns the status code as reported by the sendError() method.Retrieve a response header field by name.Retrieve the names of the header fields that have been set on this response.Vector[]
int
getIntHeader
(String name) Retrieve a response header as an int.long
Returns the date that the data was last modifed in this response or -1 if unknown.byte[]
Get the output from the response outputstream as a String.jakarta.servlet.ServletOutputStream
Returns the target URI of the redirect as specified by the sendRedirect() method.int
Returns the status code as specifed by the setStatus() method.Returns the status message as reported by the setStatus() method.void
boolean
boolean
Return true if the data in this response has expired.boolean
boolean
Returns true if sendRedirect() was called.boolean
void
void
removeCookie
(String cookieName) void
reset()
void
Clears the content of the underlying buffer in the response without clearing headers or status code.void
sendError
(int sc) void
void
sendRedirect
(String uri) void
sendRedirect303
(String uri) void
setBufferSize
(int size) void
setCharacterEncoding
(String encoding) void
setContentLength
(int len) void
setContentType
(String type) void
setDateHeader
(String name, long value) void
void
void
setInclude
(boolean isInclude) void
setInternalHeader
(String name, String value) void
setInternalHeaderSettable
(boolean internalHeaderSettable) void
setIntHeader
(String name, int value) void
void
setStatus
(int sc) void
void
start()
void
transferResponse
(jakarta.servlet.http.HttpServletResponse target) Copy the contents of this response to another HttpServletResponse.boolean
Methods inherited from class jakarta.servlet.http.HttpServletResponseWrapper
getHeaders, getStatus
Methods inherited from class jakarta.servlet.ServletResponseWrapper
getResponse, isWrapperFor, isWrapperFor, setResponse
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.servlet.http.HttpServletResponse
getHeaders, getStatus
-
Constructor Details
-
StoredResponse
public StoredResponse() -
StoredResponse
public StoredResponse(boolean isInclude) -
StoredResponse
-
-
Method Details
-
writerObtained
public boolean writerObtained()- Specified by:
writerObtained
in interfacecom.ibm.wsspi.webcontainer.util.IResponseOutput
-
outputStreamObtained
public boolean outputStreamObtained()- Specified by:
outputStreamObtained
in interfacecom.ibm.wsspi.webcontainer.util.IResponseOutput
-
addCookie
public void addCookie(jakarta.servlet.http.Cookie cookie) - Specified by:
addCookie
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
addCookie
in classjakarta.servlet.http.HttpServletResponseWrapper
-
getIResponse
- Specified by:
getIResponse
in interfaceIExtendedResponse
- Specified by:
getIResponse
in interfaceServletResponseExtended
-
getOutputStream
public jakarta.servlet.ServletOutputStream getOutputStream() throws IllegalStateException, IOException- Specified by:
getOutputStream
in interfacejakarta.servlet.ServletResponse
- Overrides:
getOutputStream
in classjakarta.servlet.ServletResponseWrapper
- Throws:
IllegalStateException
IOException
-
setContentLength
public void setContentLength(int len) - Specified by:
setContentLength
in interfacejakarta.servlet.ServletResponse
- Overrides:
setContentLength
in classjakarta.servlet.ServletResponseWrapper
-
setContentType
- Specified by:
setContentType
in interfacejakarta.servlet.ServletResponse
- Overrides:
setContentType
in classjakarta.servlet.ServletResponseWrapper
-
setBufferSize
- Specified by:
setBufferSize
in interfacejakarta.servlet.ServletResponse
- Overrides:
setBufferSize
in classjakarta.servlet.ServletResponseWrapper
- Throws:
IllegalStateException
-
getBufferSize
public int getBufferSize()- Specified by:
getBufferSize
in interfacejakarta.servlet.ServletResponse
- Overrides:
getBufferSize
in classjakarta.servlet.ServletResponseWrapper
-
flushBuffer
- Specified by:
flushBuffer
in interfacejakarta.servlet.ServletResponse
- Overrides:
flushBuffer
in classjakarta.servlet.ServletResponseWrapper
- Throws:
IOException
-
flushBuffer
- Specified by:
flushBuffer
in interfacecom.ibm.wsspi.webcontainer.util.IResponseOutput
- Throws:
IOException
-
isCommitted
public boolean isCommitted()- Specified by:
isCommitted
in interfacecom.ibm.wsspi.webcontainer.util.IResponseOutput
- Specified by:
isCommitted
in interfacejakarta.servlet.ServletResponse
- Overrides:
isCommitted
in classjakarta.servlet.ServletResponseWrapper
-
reset
- Specified by:
reset
in interfacecom.ibm.wsspi.webcontainer.util.IResponseOutput
- Specified by:
reset
in interfacejakarta.servlet.ServletResponse
- Overrides:
reset
in classjakarta.servlet.ServletResponseWrapper
- Throws:
IllegalStateException
-
getHeaderTable
- Specified by:
getHeaderTable
in interfaceIExtendedResponse
- Specified by:
getHeaderTable
in interfaceServletResponseExtended
-
addSessionCookie
public void addSessionCookie(jakarta.servlet.http.Cookie cookie) - Specified by:
addSessionCookie
in interfaceIExtendedResponse
- Specified by:
addSessionCookie
in interfaceServletResponseExtended
-
setLocale
- Specified by:
setLocale
in interfacejakarta.servlet.ServletResponse
- Overrides:
setLocale
in classjakarta.servlet.ServletResponseWrapper
-
setCharacterEncoding
- Specified by:
setCharacterEncoding
in interfacejakarta.servlet.ServletResponse
- Overrides:
setCharacterEncoding
in classjakarta.servlet.ServletResponseWrapper
-
getLocale
- Specified by:
getLocale
in interfacejakarta.servlet.ServletResponse
- Overrides:
getLocale
in classjakarta.servlet.ServletResponseWrapper
-
addDateHeader
- Specified by:
addDateHeader
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
addDateHeader
in classjakarta.servlet.http.HttpServletResponseWrapper
-
addHeader
- Specified by:
addHeader
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
addHeader
in classjakarta.servlet.http.HttpServletResponseWrapper
-
addIntHeader
- Specified by:
addIntHeader
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
addIntHeader
in classjakarta.servlet.http.HttpServletResponseWrapper
-
setHeader
- Specified by:
setHeader
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
setHeader
in classjakarta.servlet.http.HttpServletResponseWrapper
-
setInternalHeader
- Specified by:
setInternalHeader
in interfaceIExtendedResponse
-
setHeader
- Specified by:
setHeader
in interfaceIExtendedResponse
- Specified by:
setHeader
in interfaceServletResponseExtended
-
setIntHeader
- Specified by:
setIntHeader
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
setIntHeader
in classjakarta.servlet.http.HttpServletResponseWrapper
-
setDateHeader
- Specified by:
setDateHeader
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
setDateHeader
in classjakarta.servlet.http.HttpServletResponseWrapper
-
containsHeader
- Specified by:
containsHeader
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
containsHeader
in classjakarta.servlet.http.HttpServletResponseWrapper
-
getWriter
- Specified by:
getWriter
in interfacejakarta.servlet.ServletResponse
- Overrides:
getWriter
in classjakarta.servlet.ServletResponseWrapper
- Throws:
IOException
IllegalStateException
-
setStatus
public void setStatus(int sc) - Specified by:
setStatus
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
setStatus
in classjakarta.servlet.http.HttpServletResponseWrapper
-
setStatus
- Specified by:
setStatus
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
setStatus
in classjakarta.servlet.http.HttpServletResponseWrapper
-
sendError
- Specified by:
sendError
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
sendError
in classjakarta.servlet.http.HttpServletResponseWrapper
- Throws:
IOException
-
sendError
- Specified by:
sendError
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
sendError
in classjakarta.servlet.http.HttpServletResponseWrapper
- Throws:
IOException
-
encodeURL
- Specified by:
encodeURL
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
encodeURL
in classjakarta.servlet.http.HttpServletResponseWrapper
-
encodeUrl
- Specified by:
encodeUrl
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
encodeUrl
in classjakarta.servlet.http.HttpServletResponseWrapper
-
sendRedirect
- Specified by:
sendRedirect
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
sendRedirect
in classjakarta.servlet.http.HttpServletResponseWrapper
- Throws:
IOException
-
sendRedirect303
- Specified by:
sendRedirect303
in interfaceIExtendedResponse
- Throws:
IOException
-
encodeRedirectURL
- Specified by:
encodeRedirectURL
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
encodeRedirectURL
in classjakarta.servlet.http.HttpServletResponseWrapper
-
encodeRedirectUrl
- Specified by:
encodeRedirectUrl
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
encodeRedirectUrl
in classjakarta.servlet.http.HttpServletResponseWrapper
-
finish
- Specified by:
finish
in interfaceIExtendedResponse
- Throws:
IOException
-
close
- Throws:
IOException
-
getOutputBuffer
- Throws:
IOException
-
getByteBufferList
- Throws:
IOException
-
getOutputBufferAsString
Get the output from the response outputstream as a String. This method should only be used to retrieve content that is known to be text based. Using this method to retrieve binary data will corrupt the response data.- Throws:
IOException
-
getHeaderNames
Retrieve the names of the header fields that have been set on this response.- Specified by:
getHeaderNames
in interfacejakarta.servlet.http.HttpServletResponse
- Specified by:
getHeaderNames
in interfaceStoredResponseCompat<CollectionEnumerationHybrid<String>>
- Overrides:
getHeaderNames
in classjakarta.servlet.http.HttpServletResponseWrapper
-
getAddedHeaderNames
Retrieve only the headers set in the include -
getHeader
Retrieve a response header field by name.- Specified by:
getHeader
in interfacejakarta.servlet.http.HttpServletResponse
- Overrides:
getHeader
in classjakarta.servlet.http.HttpServletResponseWrapper
-
getIntHeader
Retrieve a response header as an int. -
getDateHeader
Retrieve a response header as a date. -
containsError
public boolean containsError()Returns true if sendError() was called on this response. -
getError
public com.ibm.websphere.servlet.error.ServletErrorReport getError() -
getErrorMessage
Returns the error message as reported by the sendError() method. -
getErrorStatusCode
public int getErrorStatusCode()Returns the status code as reported by the sendError() method. -
getStatusCode
public int getStatusCode()Returns the status code as specifed by the setStatus() method.- Specified by:
getStatusCode
in interfaceIExtendedResponse
- Specified by:
getStatusCode
in interfaceServletResponseExtended
-
getStatusMessage
Returns the status message as reported by the setStatus() method. -
getRedirectURI
Returns the target URI of the redirect as specified by the sendRedirect() method. -
isRedirected
public boolean isRedirected()Returns true if sendRedirect() was called. -
getCharacterEncoding
Return the character encoding as specified in the charset flag of the content-type.- Specified by:
getCharacterEncoding
in interfacejakarta.servlet.ServletResponse
- Overrides:
getCharacterEncoding
in classjakarta.servlet.ServletResponseWrapper
-
getContentType
- Specified by:
getContentType
in interfacejakarta.servlet.ServletResponse
- Overrides:
getContentType
in classjakarta.servlet.ServletResponseWrapper
-
getCookies
public jakarta.servlet.http.Cookie[] getCookies()Return the cookies that were set using the addCookie() method. -
getLastModified
public long getLastModified()Returns the date that the data was last modifed in this response or -1 if unknown. This method returns the date value specified in the last-modified header. -
isExpired
public boolean isExpired()Return true if the data in this response has expired. This method is useful for caches to determine if the response is up-to-date or if if it should be cleared from the cache. This method returns false by default, subclasses should overload this method to provide their own expiration policies. -
transferResponse
Copy the contents of this response to another HttpServletResponse. This method is optimized to quickly transfer the contents of this response into another response. This method is useful when this response is cached to generate the same response later.- Throws:
IOException
-
resetBuffer
public void resetBuffer()Clears the content of the underlying buffer in the response without clearing headers or status code.- Specified by:
resetBuffer
in interfacejakarta.servlet.ServletResponse
- Overrides:
resetBuffer
in classjakarta.servlet.ServletResponseWrapper
- Since:
- 2.3
-
fireOutputStreamRetrievedEvent
public void fireOutputStreamRetrievedEvent(jakarta.servlet.ServletOutputStream sos) - Specified by:
fireOutputStreamRetrievedEvent
in interfaceIExtendedResponse
-
fireWriterRetrievedEvent
- Specified by:
fireWriterRetrievedEvent
in interfaceIExtendedResponse
-
registerOutputMethodListener
- Specified by:
registerOutputMethodListener
in interfaceIExtendedResponse
-
destroy
public void destroy()- Specified by:
destroy
in interfaceIExtendedResponse
-
initForNextResponse
- Specified by:
initForNextResponse
in interfaceIExtendedResponse
-
start
public void start()- Specified by:
start
in interfaceIExtendedResponse
-
setInclude
public void setInclude(boolean isInclude) -
setInternalHeaderSettable
public void setInternalHeaderSettable(boolean internalHeaderSettable) -
buildResponseData
-
buildWriterData
-
alertClose
public void alertClose()- Specified by:
alertClose
in interfacecom.ibm.wsspi.webcontainer.util.IOutputStreamObserver
-
alertException
public void alertException()- Specified by:
alertException
in interfacecom.ibm.wsspi.webcontainer.util.IOutputStreamObserver
-
alertFirstFlush
public void alertFirstFlush()- Specified by:
alertFirstFlush
in interfacecom.ibm.wsspi.webcontainer.util.IOutputStreamObserver
-
alertFirstWrite
public void alertFirstWrite()- Specified by:
alertFirstWrite
in interfacecom.ibm.wsspi.webcontainer.util.IOutputStreamObserver
-
closeResponseOutput
public void closeResponseOutput(boolean b) - Specified by:
closeResponseOutput
in interfaceIExtendedResponse
-
removeCookie
- Specified by:
removeCookie
in interfaceIExtendedResponse
-
isOutputWritten
public boolean isOutputWritten()- Specified by:
isOutputWritten
in interfaceIExtendedResponse
-