|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.ServletResponseWrapper javax.servlet.http.HttpServletResponseWrapper org.apache.catalina.ssi.ResponseIncludeWrapper
public class ResponseIncludeWrapper
A HttpServletResponseWrapper, used from
SSIServletExternalResolver
Field Summary | |
---|---|
protected ServletOutputStream |
captureServletOutputStream
Our ServletOutputStream |
protected long |
lastModified
|
protected PrintWriter |
printWriter
|
protected ServletOutputStream |
servletOutputStream
|
Constructor Summary | |
---|---|
ResponseIncludeWrapper(ServletContext context,
HttpServletRequest request,
HttpServletResponse response,
ServletOutputStream captureServletOutputStream)
Initialize our wrapper with the current HttpServletResponse and ServletOutputStream. |
Method Summary | |
---|---|
void |
addDateHeader(String name,
long value)
The default behavior of this method is to call addDateHeader(String name, long date) on the wrapped response object. |
void |
addHeader(String name,
String value)
The default behavior of this method is to return addHeader(String name, String value) on the wrapped response object. |
void |
flushOutputStreamOrWriter()
Flush the servletOutputStream or printWriter ( only one will be non-null ) This must be called after a requestDispatcher.include, since we can't assume that the included servlet flushed its stream. |
String |
getContentType()
Returns the value of the content-type header field. |
long |
getLastModified()
Returns the value of the last-modified header field. |
ServletOutputStream |
getOutputStream()
Return a OutputStream, throws and exception if a printwriter already been returned. |
PrintWriter |
getWriter()
Return a printwriter, throws and exception if a OutputStream already been returned. |
void |
setContentType(String mime)
Sets the value of the content-type header field. |
void |
setDateHeader(String name,
long value)
The default behavior of this method is to call setDateHeader(String name, long date) on the wrapped response object. |
void |
setHeader(String name,
String value)
The default behavior of this method is to return setHeader(String name, String value) on the wrapped response object. |
void |
setLastModified(long lastModified)
Sets the value of the last-modified header field. |
Methods inherited from class javax.servlet.http.HttpServletResponseWrapper |
---|
addCookie, addIntHeader, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, getHeader, getHeaderNames, getHeaders, getStatus, sendError, sendError, sendRedirect, setIntHeader, setStatus, setStatus |
Methods inherited from class javax.servlet.ServletResponseWrapper |
---|
flushBuffer, getBufferSize, getCharacterEncoding, getLocale, getResponse, isCommitted, isWrapperFor, isWrapperFor, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setLocale, setResponse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.ServletResponse |
---|
flushBuffer, getBufferSize, getCharacterEncoding, getLocale, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setLocale |
Field Detail |
---|
protected long lastModified
protected ServletOutputStream captureServletOutputStream
protected ServletOutputStream servletOutputStream
protected PrintWriter printWriter
Constructor Detail |
---|
public ResponseIncludeWrapper(ServletContext context, HttpServletRequest request, HttpServletResponse response, ServletOutputStream captureServletOutputStream)
context
- The servlet contextrequest
- The HttpServletResponse to useresponse
- The response to usecaptureServletOutputStream
- The ServletOutputStream to useMethod Detail |
---|
public void flushOutputStreamOrWriter() throws IOException
IOException
public PrintWriter getWriter() throws IOException
getWriter
in interface ServletResponse
getWriter
in class ServletResponseWrapper
IOException
- if the outputstream already been called
UnsupportedEncodingException
- if the character encoding returned by
getCharacterEncoding
cannot be usedServletResponse.getOutputStream()
,
ServletResponse.setCharacterEncoding(java.lang.String)
public ServletOutputStream getOutputStream() throws IOException
getOutputStream
in interface ServletResponse
getOutputStream
in class ServletResponseWrapper
IOException
- if the printwriter already been calledServletResponse.getWriter()
public long getLastModified()
last-modified
header field. The
result is the number of milliseconds since January 1, 1970 GMT.
ResponseIncludeWrapper
was last modified, or -1 if not
known.public void setLastModified(long lastModified)
last-modified
header field.
lastModified
- The number of milliseconds since January 1, 1970 GMT.public String getContentType()
content-type
header field.
getContentType
in interface ServletResponse
getContentType
in class ServletResponseWrapper
ResponseIncludeWrapper
, or null
if not known.public void setContentType(String mime)
content-type
header field.
setContentType
in interface ServletResponse
setContentType
in class ServletResponseWrapper
mime
- a mime typeServletResponse.setLocale(java.util.Locale)
,
ServletResponse.setCharacterEncoding(java.lang.String)
,
ServletResponse.getOutputStream()
,
ServletResponse.getWriter()
public void addDateHeader(String name, long value)
javax.servlet.http.HttpServletResponseWrapper
addDateHeader
in interface HttpServletResponse
addDateHeader
in class HttpServletResponseWrapper
name
- the name of the header to setvalue
- the additional date valueHttpServletResponse.setDateHeader(java.lang.String, long)
public void addHeader(String name, String value)
javax.servlet.http.HttpServletResponseWrapper
addHeader
in interface HttpServletResponse
addHeader
in class HttpServletResponseWrapper
name
- the name of the headervalue
- the additional header value If it contains octet string, it
should be encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt)HttpServletResponse.setHeader(java.lang.String, java.lang.String)
public void setDateHeader(String name, long value)
javax.servlet.http.HttpServletResponseWrapper
setDateHeader
in interface HttpServletResponse
setDateHeader
in class HttpServletResponseWrapper
name
- the name of the header to setvalue
- the assigned date valueHttpServletResponse.containsHeader(java.lang.String)
,
HttpServletResponse.addDateHeader(java.lang.String, long)
public void setHeader(String name, String value)
javax.servlet.http.HttpServletResponseWrapper
setHeader
in interface HttpServletResponse
setHeader
in class HttpServletResponseWrapper
name
- the name of the headervalue
- the header value If it contains octet string, it should be
encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt)HttpServletResponse.containsHeader(java.lang.String)
,
HttpServletResponse.addHeader(java.lang.String, java.lang.String)
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |