Class StoredResponse
java.lang.Object
javax.servlet.ServletResponseWrapper
javax.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
,javax.servlet.http.HttpServletResponse
,javax.servlet.ServletResponse
- Direct Known Subclasses:
ChainedResponse
public class StoredResponse
extends javax.servlet.http.HttpServletResponseWrapper
implements StoredResponseCompat<CollectionEnumerationHybrid<String>>, javax.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 javax.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
(javax.servlet.http.Cookie cookie) void
addDateHeader
(String name, long date) void
void
addIntHeader
(String name, int value) void
addSessionCookie
(javax.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
(javax.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.javax.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.javax.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
(javax.servlet.http.HttpServletResponse target) Copy the contents of this response to another HttpServletResponse.boolean
Methods inherited from class javax.servlet.http.HttpServletResponseWrapper
getHeaders, getStatus
Methods inherited from class javax.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 javax.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(javax.servlet.http.Cookie cookie) - Specified by:
addCookie
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
addCookie
in classjavax.servlet.http.HttpServletResponseWrapper
-
getIResponse
- Specified by:
getIResponse
in interfaceIExtendedResponse
- Specified by:
getIResponse
in interfaceServletResponseExtended
-
getOutputStream
public javax.servlet.ServletOutputStream getOutputStream() throws IllegalStateException, IOException- Specified by:
getOutputStream
in interfacejavax.servlet.ServletResponse
- Overrides:
getOutputStream
in classjavax.servlet.ServletResponseWrapper
- Throws:
IllegalStateException
IOException
-
setContentLength
public void setContentLength(int len) - Specified by:
setContentLength
in interfacejavax.servlet.ServletResponse
- Overrides:
setContentLength
in classjavax.servlet.ServletResponseWrapper
-
setContentType
- Specified by:
setContentType
in interfacejavax.servlet.ServletResponse
- Overrides:
setContentType
in classjavax.servlet.ServletResponseWrapper
-
setBufferSize
- Specified by:
setBufferSize
in interfacejavax.servlet.ServletResponse
- Overrides:
setBufferSize
in classjavax.servlet.ServletResponseWrapper
- Throws:
IllegalStateException
-
getBufferSize
public int getBufferSize()- Specified by:
getBufferSize
in interfacejavax.servlet.ServletResponse
- Overrides:
getBufferSize
in classjavax.servlet.ServletResponseWrapper
-
flushBuffer
- Specified by:
flushBuffer
in interfacejavax.servlet.ServletResponse
- Overrides:
flushBuffer
in classjavax.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 interfacejavax.servlet.ServletResponse
- Overrides:
isCommitted
in classjavax.servlet.ServletResponseWrapper
-
reset
- Specified by:
reset
in interfacecom.ibm.wsspi.webcontainer.util.IResponseOutput
- Specified by:
reset
in interfacejavax.servlet.ServletResponse
- Overrides:
reset
in classjavax.servlet.ServletResponseWrapper
- Throws:
IllegalStateException
-
getHeaderTable
- Specified by:
getHeaderTable
in interfaceIExtendedResponse
- Specified by:
getHeaderTable
in interfaceServletResponseExtended
-
addSessionCookie
public void addSessionCookie(javax.servlet.http.Cookie cookie) - Specified by:
addSessionCookie
in interfaceIExtendedResponse
- Specified by:
addSessionCookie
in interfaceServletResponseExtended
-
setLocale
- Specified by:
setLocale
in interfacejavax.servlet.ServletResponse
- Overrides:
setLocale
in classjavax.servlet.ServletResponseWrapper
-
setCharacterEncoding
- Specified by:
setCharacterEncoding
in interfacejavax.servlet.ServletResponse
- Overrides:
setCharacterEncoding
in classjavax.servlet.ServletResponseWrapper
-
getLocale
- Specified by:
getLocale
in interfacejavax.servlet.ServletResponse
- Overrides:
getLocale
in classjavax.servlet.ServletResponseWrapper
-
addDateHeader
- Specified by:
addDateHeader
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
addDateHeader
in classjavax.servlet.http.HttpServletResponseWrapper
-
addHeader
- Specified by:
addHeader
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
addHeader
in classjavax.servlet.http.HttpServletResponseWrapper
-
addIntHeader
- Specified by:
addIntHeader
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
addIntHeader
in classjavax.servlet.http.HttpServletResponseWrapper
-
setHeader
- Specified by:
setHeader
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
setHeader
in classjavax.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 interfacejavax.servlet.http.HttpServletResponse
- Overrides:
setIntHeader
in classjavax.servlet.http.HttpServletResponseWrapper
-
setDateHeader
- Specified by:
setDateHeader
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
setDateHeader
in classjavax.servlet.http.HttpServletResponseWrapper
-
containsHeader
- Specified by:
containsHeader
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
containsHeader
in classjavax.servlet.http.HttpServletResponseWrapper
-
getWriter
- Specified by:
getWriter
in interfacejavax.servlet.ServletResponse
- Overrides:
getWriter
in classjavax.servlet.ServletResponseWrapper
- Throws:
IOException
IllegalStateException
-
setStatus
public void setStatus(int sc) - Specified by:
setStatus
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
setStatus
in classjavax.servlet.http.HttpServletResponseWrapper
-
setStatus
- Specified by:
setStatus
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
setStatus
in classjavax.servlet.http.HttpServletResponseWrapper
-
sendError
- Specified by:
sendError
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
sendError
in classjavax.servlet.http.HttpServletResponseWrapper
- Throws:
IOException
-
sendError
- Specified by:
sendError
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
sendError
in classjavax.servlet.http.HttpServletResponseWrapper
- Throws:
IOException
-
encodeURL
- Specified by:
encodeURL
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
encodeURL
in classjavax.servlet.http.HttpServletResponseWrapper
-
encodeUrl
- Specified by:
encodeUrl
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
encodeUrl
in classjavax.servlet.http.HttpServletResponseWrapper
-
sendRedirect
- Specified by:
sendRedirect
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
sendRedirect
in classjavax.servlet.http.HttpServletResponseWrapper
- Throws:
IOException
-
sendRedirect303
- Specified by:
sendRedirect303
in interfaceIExtendedResponse
- Throws:
IOException
-
encodeRedirectURL
- Specified by:
encodeRedirectURL
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
encodeRedirectURL
in classjavax.servlet.http.HttpServletResponseWrapper
-
encodeRedirectUrl
- Specified by:
encodeRedirectUrl
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
encodeRedirectUrl
in classjavax.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 interfacejavax.servlet.http.HttpServletResponse
- Specified by:
getHeaderNames
in interfaceStoredResponseCompat<CollectionEnumerationHybrid<String>>
- Overrides:
getHeaderNames
in classjavax.servlet.http.HttpServletResponseWrapper
-
getAddedHeaderNames
Retrieve only the headers set in the include -
getHeader
Retrieve a response header field by name.- Specified by:
getHeader
in interfacejavax.servlet.http.HttpServletResponse
- Overrides:
getHeader
in classjavax.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 interfacejavax.servlet.ServletResponse
- Overrides:
getCharacterEncoding
in classjavax.servlet.ServletResponseWrapper
-
getContentType
- Specified by:
getContentType
in interfacejavax.servlet.ServletResponse
- Overrides:
getContentType
in classjavax.servlet.ServletResponseWrapper
-
getCookies
public javax.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 interfacejavax.servlet.ServletResponse
- Overrides:
resetBuffer
in classjavax.servlet.ServletResponseWrapper
- Since:
- 2.3
-
fireOutputStreamRetrievedEvent
public void fireOutputStreamRetrievedEvent(javax.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
-