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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidintGets the captured output.booleanvoidreset()voidvoidsetBufferSize(int size) voidsetCharacterEncoding(String charset) voidsetContentLength(int len) voidsetContentLengthLong(long len) voidsetContentType(String type) void
-
Field Details
-
committed
protected boolean committed
-
-
Constructor Details
-
ServletSubResponse
-
-
Method Details
-
setCharacterEncoding
- Specified by:
setCharacterEncodingin interfaceServletResponse
-
getCharacterEncoding
- Specified by:
getCharacterEncodingin interfaceServletResponse
-
getOutputStream
- Specified by:
getOutputStreamin interfaceServletResponse- Throws:
IOException
-
getWriter
- Specified by:
getWriterin interfaceServletResponse- Throws:
IOException
-
getCapturedOut
Description copied from interface:IServletSubResponseGets the captured output. This closes the associated capturing writer. Any subsequent writes will create a new buffer.- Specified by:
getCapturedOutin interfaceIServletSubResponse- Throws:
IOException
-
setContentLength
public void setContentLength(int len) - Specified by:
setContentLengthin interfaceServletResponse
-
setContentLengthLong
public void setContentLengthLong(long len) - Specified by:
setContentLengthLongin interfaceServletResponse
-
setContentType
- Specified by:
setContentTypein interfaceServletResponse
-
getContentType
- Specified by:
getContentTypein interfaceServletResponse
-
setBufferSize
public void setBufferSize(int size) - Specified by:
setBufferSizein interfaceServletResponse
-
getBufferSize
public int getBufferSize()- Specified by:
getBufferSizein interfaceServletResponse
-
flushBuffer
- Specified by:
flushBufferin interfaceServletResponse- Throws:
IOException
-
isCommitted
public boolean isCommitted()- Specified by:
isCommittedin interfaceServletResponse
-
reset
public void reset()- Specified by:
resetin interfaceServletResponse
-
resetBuffer
public void resetBuffer()- Specified by:
resetBufferin interfaceServletResponse
-
setLocale
- Specified by:
setLocalein interfaceServletResponse
-
getLocale
- Specified by:
getLocalein interfaceServletResponse
-
