java.lang.Object
com.aoapps.servlet.subrequest.ServletSubResponse
- All Implemented Interfaces:
IServletSubResponse
,ServletResponse
- Direct Known Subclasses:
HttpServletSubResponse
This does not implement
ServletResponseWrapper
and use of it is in violation
of the specification. When used in conjunction with new threads (or threads
from your own pool), Tomcat 7.0 and 8.5 do not notice you switched the response due to its
use of ThreadLocal to enforce the spec. This is very hackish and fragile - use at
your own risk.
Wraps a servlet response with the intent to operate as a concurrent sub response. Any changes made to the response will only affect this response and will not be passed along to the wrapped response.
It is expected that the wrapped response will not change for the life of this wrapper. If it does change, the changes may or may not be visible depending on what has been accessed and changed on this response.
This class is not thread safe.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
int
Gets the captured output.boolean
void
reset()
void
void
setBufferSize
(int size) void
setCharacterEncoding
(String charset) void
setContentLength
(int len) void
setContentLengthLong
(long len) void
setContentType
(String type) void
-
Field Details
-
committed
protected boolean committed
-
-
Constructor Details
-
ServletSubResponse
-
-
Method Details
-
setCharacterEncoding
- Specified by:
setCharacterEncoding
in interfaceServletResponse
-
getCharacterEncoding
- Specified by:
getCharacterEncoding
in interfaceServletResponse
-
getOutputStream
- Specified by:
getOutputStream
in interfaceServletResponse
- Throws:
IOException
-
getWriter
- Specified by:
getWriter
in interfaceServletResponse
- Throws:
IOException
-
getCapturedOut
Description copied from interface:IServletSubResponse
Gets the captured output. This closes the associated capturing writer. Any subsequent writes will create a new buffer.- Specified by:
getCapturedOut
in interfaceIServletSubResponse
- Throws:
IOException
-
setContentLength
public void setContentLength(int len) - Specified by:
setContentLength
in interfaceServletResponse
-
setContentLengthLong
public void setContentLengthLong(long len) - Specified by:
setContentLengthLong
in interfaceServletResponse
-
setContentType
- Specified by:
setContentType
in interfaceServletResponse
-
getContentType
- Specified by:
getContentType
in interfaceServletResponse
-
setBufferSize
public void setBufferSize(int size) - Specified by:
setBufferSize
in interfaceServletResponse
-
getBufferSize
public int getBufferSize()- Specified by:
getBufferSize
in interfaceServletResponse
-
flushBuffer
- Specified by:
flushBuffer
in interfaceServletResponse
- Throws:
IOException
-
isCommitted
public boolean isCommitted()- Specified by:
isCommitted
in interfaceServletResponse
-
reset
public void reset()- Specified by:
reset
in interfaceServletResponse
-
resetBuffer
public void resetBuffer()- Specified by:
resetBuffer
in interfaceServletResponse
-
setLocale
- Specified by:
setLocale
in interfaceServletResponse
-
getLocale
- Specified by:
getLocale
in interfaceServletResponse
-