java.lang.Object
org.apache.wicket.request.Response
org.apache.wicket.request.http.WebResponse
org.apache.wicket.protocol.http.BufferedWebResponse
- All Implemented Interfaces:
IMetaDataBufferingWebResponse
Subclass of
WebResponse
that buffers the actions and performs those on another response.- Author:
- Matej Knopp
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.wicket.request.http.WebResponse
WebResponse.CacheScope
-
Field Summary
Fields inherited from class org.apache.wicket.request.http.WebResponse
MAX_CACHE_DURATION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCookie
(jakarta.servlet.http.Cookie cookie) Add a cookie to the web responsevoid
Add a value to the servlet response stream.void
clearCookie
(jakarta.servlet.http.Cookie cookie) Convenience method for clearing a cookie.void
Make this response non-cacheableEncodes urls used to redirect.encodeURL
(CharSequence url) Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.void
flush()
Flushes the response.Provides access to the low-level container response object that implementaion of thisResponse
delegate to.getText()
Returns the text already written to this response.boolean
Indicates if the response supports setting headers.boolean
void
reset()
Called when the Response needs to reset itself.void
Send error status code with optional message.void
sendRedirect
(String url) Redirects the response to specified URL.void
setContentLength
(long length) Set the content length on the response, if appropriate in the subclass.void
setContentType
(String mimeType) Set the content type on the response, if appropriate in the subclass.void
setDateHeader
(String name, Instant date) Set a header to the date value in the servlet response stream.void
Set a header to the string value in the servlet response stream.void
setStatus
(int sc) Sets the status code for this response.void
setText
(CharSequence text) Replaces the text in this responsetoString()
void
write
(byte[] array) Writes the buffer to output.void
write
(byte[] array, int offset, int length) Writes the buffer to output.void
write
(CharSequence sequence) Writes theCharSequence
to output.void
writeMetaData
(WebResponse response) transfer cookie operations (add, clear) to given web responsevoid
writeTo
(WebResponse response) Writes the content of the buffer to the specified response.Methods inherited from class org.apache.wicket.request.http.WebResponse
enableCaching, setAcceptRange, setAttachmentHeader, setContentRange, setInlineHeader, setLastModifiedTime
Methods inherited from class org.apache.wicket.request.Response
close, getOutputStream
-
Constructor Details
-
BufferedWebResponse
Construct.- Parameters:
originalResponse
-
-
-
Method Details
-
writeMetaData
transfer cookie operations (add, clear) to given web response- Specified by:
writeMetaData
in interfaceIMetaDataBufferingWebResponse
- Parameters:
response
- web response that should receive the current cookie operation
-
encodeURL
Description copied from class:Response
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. -
encodeRedirectURL
Description copied from class:WebResponse
Encodes urls used to redirect. Sometimes rules for encoding URLs for redirecting differ from encoding URLs for links, so this method is broken out away formResponse.encodeURL(CharSequence)
.- Specified by:
encodeRedirectURL
in classWebResponse
- Returns:
- encoded URL
-
reset
Description copied from class:Response
Called when the Response needs to reset itself. Subclasses can empty there buffer or build up state. -
addCookie
Description copied from class:WebResponse
Add a cookie to the web response- Specified by:
addCookie
in classWebResponse
-
clearCookie
Description copied from class:WebResponse
Convenience method for clearing a cookie.- Specified by:
clearCookie
in classWebResponse
- Parameters:
cookie
- The cookie to set- See Also:
-
setContentLength
Description copied from class:WebResponse
Set the content length on the response, if appropriate in the subclass. This default implementation does nothing.- Specified by:
setContentLength
in classWebResponse
- Parameters:
length
- The length of the content
-
setContentType
Description copied from class:WebResponse
Set the content type on the response, if appropriate in the subclass. This default implementation does nothing.- Specified by:
setContentType
in classWebResponse
- Parameters:
mimeType
- The mime type
-
setDateHeader
Description copied from class:WebResponse
Set a header to the date value in the servlet response stream.- Specified by:
setDateHeader
in classWebResponse
-
isHeaderSupported
Description copied from class:WebResponse
Indicates if the response supports setting headers. When this method returns false,WebResponse.setHeader(String, String)
and its variations will thrown anUnsupportedOperationException
.- Specified by:
isHeaderSupported
in classWebResponse
- Returns:
- True when this
WebResponse
supports setting headers.
-
setHeader
Description copied from class:WebResponse
Set a header to the string value in the servlet response stream.- Specified by:
setHeader
in classWebResponse
-
addHeader
Description copied from class:WebResponse
Add a value to the servlet response stream.- Specified by:
addHeader
in classWebResponse
-
disableCaching
Description copied from class:WebResponse
Make this response non-cacheable- Overrides:
disableCaching
in classWebResponse
-
write
Description copied from class:Response
Writes theCharSequence
to output. -
getText
Returns the text already written to this response.- Returns:
- text
-
setText
Replaces the text in this response- Parameters:
text
-
-
write
Description copied from class:Response
Writes the buffer to output. -
write
Description copied from class:Response
Writes the buffer to output. -
sendRedirect
Description copied from class:WebResponse
Redirects the response to specified URL. The implementation is responsible for properly encoding the URL. Implementations of this method should run passed inurl
parameters through theWebResponse.encodeRedirectURL(CharSequence)
method.- Specified by:
sendRedirect
in classWebResponse
-
setStatus
Description copied from class:WebResponse
Sets the status code for this response.- Specified by:
setStatus
in classWebResponse
- Parameters:
sc
- status code
-
sendError
Description copied from class:WebResponse
Send error status code with optional message.- Specified by:
sendError
in classWebResponse
-
writeTo
Writes the content of the buffer to the specified response. Also sets the properties and and headers.- Parameters:
response
-
-
isRedirect
- Specified by:
isRedirect
in classWebResponse
- Returns:
true
isWebResponse.sendRedirect(String)
was called,false
otherwise.
-
flush
Description copied from class:WebResponse
Flushes the response.- Specified by:
flush
in classWebResponse
-
toString
-
getContainerResponse
Description copied from class:Response
Provides access to the low-level container response object that implementaion of thisResponse
delegate to. This allows users to access features provided by the container response but not by generalized WicketResponse
objects.- Specified by:
getContainerResponse
in classResponse
- Returns:
- low-level container response object, or
null
if none
-