public class CmsFlexResponse
extends javax.servlet.http.HttpServletResponseWrapper
This class wraps the standard HttpServletResponse so that it's output can be delivered to the CmsFlexCache.
限定符和类型 | 字段和说明 |
---|---|
static char |
FLEX_CACHE_DELIMITER
The cache delimiter char.
|
protected static org.apache.commons.logging.Log |
LOG
The log object for this class.
|
static java.lang.String |
SET_HEADER
Static string to indicate a header is "set" in the header maps.
|
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
构造器和说明 |
---|
CmsFlexResponse(javax.servlet.http.HttpServletResponse res,
CmsFlexController controller)
Constructor for the CmsFlexResponse,
this variation one is usually used to wrap responses for further include calls in OpenCms.
|
CmsFlexResponse(javax.servlet.http.HttpServletResponse res,
CmsFlexController controller,
boolean streaming,
boolean isTopElement)
Constructor for the CmsFlexResponse,
this variation is usually used for the "top" response.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Method overloaded from the standard HttpServletRequest API.
|
void |
addDateHeader(java.lang.String name,
long date)
Method overload from the standard HttpServletRequest API.
|
void |
addHeader(java.lang.String name,
java.lang.String value)
Method overload from the standard HttpServletRequest API.
|
void |
addIntHeader(java.lang.String name,
int value)
Method overload from the standard HttpServletRequest API.
|
void |
addToIncludeList(java.lang.String target,
java.util.Map<java.lang.String,java.lang.String[]> parameterMap,
java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Adds an inclusion target to the list of include results.
|
void |
flushBuffer() |
java.lang.String |
getEncoding()
Returns the value of the encoding used for this response.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getHeaders()
Provides access to the header cache of the top wrapper.
|
javax.servlet.ServletOutputStream |
getOutputStream()
Method overload from the standard HttpServletRequest API.
|
java.io.PrintWriter |
getWriter()
Method overload from the standard HttpServletRequest API.
|
byte[] |
getWriterBytes()
Returns the bytes that have been written on the current writers output stream.
|
boolean |
isSuspended()
This flag indicates if the response is suspended or not.
|
boolean |
isTopElement()
Returns
true if this response has been constructed for the
top level element of this request, false if it was
constructed for an included sub-element. |
static void |
processHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers,
javax.servlet.http.HttpServletResponse res)
Process the headers stored in the provided map and add them to the response.
|
void |
sendRedirect(java.lang.String location)
Method overload from the standard HttpServletRequest API.
|
void |
setContentType(java.lang.String type)
Method overload from the standard HttpServletRequest API.
|
void |
setDateHeader(java.lang.String name,
long date)
Method overload from the standard HttpServletRequest API.
|
void |
setHeader(java.lang.String name,
java.lang.String value)
Method overload from the standard HttpServletRequest API.
|
void |
setIntHeader(java.lang.String name,
int value)
Method overload from the standard HttpServletRequest API.
|
void |
setOnlyBuffering(boolean value)
Sets buffering status of the response.
|
containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, sendError, sendError, setStatus, setStatus
getBufferSize, getCharacterEncoding, getContentType, getLocale, getResponse, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setLocale, setResponse
public static final char FLEX_CACHE_DELIMITER
public static final java.lang.String SET_HEADER
protected static final org.apache.commons.logging.Log LOG
public CmsFlexResponse(javax.servlet.http.HttpServletResponse res, CmsFlexController controller)
res
- the CmsFlexResponse to wrapcontroller
- the controller to usepublic CmsFlexResponse(javax.servlet.http.HttpServletResponse res, CmsFlexController controller, boolean streaming, boolean isTopElement)
res
- the HttpServletResponse to wrapcontroller
- the controller to usestreaming
- indicates if streaming should be enabled or notisTopElement
- indicates if this is the top element of an include cascadepublic static void processHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, javax.servlet.http.HttpServletResponse res)
headers
- the headers to addres
- the response to add the headers topublic void addCookie(javax.servlet.http.Cookie cookie)
Cookies must be set directly as a header, otherwise they might not be set in the super class.
addCookie
在接口中 javax.servlet.http.HttpServletResponse
addCookie
在类中 javax.servlet.http.HttpServletResponseWrapper
HttpServletResponseWrapper.addCookie(javax.servlet.http.Cookie)
public void addDateHeader(java.lang.String name, long date)
addDateHeader
在接口中 javax.servlet.http.HttpServletResponse
addDateHeader
在类中 javax.servlet.http.HttpServletResponseWrapper
HttpServletResponse.addDateHeader(java.lang.String, long)
public void addHeader(java.lang.String name, java.lang.String value)
addHeader
在接口中 javax.servlet.http.HttpServletResponse
addHeader
在类中 javax.servlet.http.HttpServletResponseWrapper
HttpServletResponse.addHeader(java.lang.String, java.lang.String)
public void addIntHeader(java.lang.String name, int value)
addIntHeader
在接口中 javax.servlet.http.HttpServletResponse
addIntHeader
在类中 javax.servlet.http.HttpServletResponseWrapper
HttpServletResponse.addIntHeader(java.lang.String, int)
public void addToIncludeList(java.lang.String target, java.util.Map<java.lang.String,java.lang.String[]> parameterMap, java.util.Map<java.lang.String,java.lang.Object> attributeMap)
Should be used only in inclusion-scenarios like the JSP cms:include tag processing.
target
- the include target name to addparameterMap
- the map of parameters given with the include commandattributeMap
- the map of attributes given with the include commandpublic void flushBuffer() throws java.io.IOException
flushBuffer
在接口中 javax.servlet.ServletResponse
flushBuffer
在类中 javax.servlet.ServletResponseWrapper
java.io.IOException
ServletResponseWrapper.flushBuffer()
public java.lang.String getEncoding()
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException
getOutputStream
在接口中 javax.servlet.ServletResponse
getOutputStream
在类中 javax.servlet.ServletResponseWrapper
java.io.IOException
ServletResponse.getOutputStream()
public java.io.PrintWriter getWriter() throws java.io.IOException
getWriter
在接口中 javax.servlet.ServletResponse
getWriter
在类中 javax.servlet.ServletResponseWrapper
java.io.IOException
ServletResponse.getWriter()
public byte[] getWriterBytes()
public boolean isSuspended()
A suspended response must not write further output to any stream or process a cache entry for itself.
Currently, a response is only suspended if it is redirected.
public boolean isTopElement()
true
if this response has been constructed for the
top level element of this request, false
if it was
constructed for an included sub-element.true
if this response has been constructed for the
top level element of this request, false
if it was
constructed for an included sub-element.public void sendRedirect(java.lang.String location) throws java.io.IOException
sendRedirect
在接口中 javax.servlet.http.HttpServletResponse
sendRedirect
在类中 javax.servlet.http.HttpServletResponseWrapper
java.lang.IllegalArgumentException
- In case of a malformed location stringjava.io.IOException
HttpServletResponse.sendRedirect(java.lang.String)
public void setContentType(java.lang.String type)
setContentType
在接口中 javax.servlet.ServletResponse
setContentType
在类中 javax.servlet.ServletResponseWrapper
ServletResponse.setContentType(java.lang.String)
public void setDateHeader(java.lang.String name, long date)
setDateHeader
在接口中 javax.servlet.http.HttpServletResponse
setDateHeader
在类中 javax.servlet.http.HttpServletResponseWrapper
HttpServletResponse.setDateHeader(java.lang.String, long)
public void setHeader(java.lang.String name, java.lang.String value)
setHeader
在接口中 javax.servlet.http.HttpServletResponse
setHeader
在类中 javax.servlet.http.HttpServletResponseWrapper
HttpServletResponse.setHeader(java.lang.String, java.lang.String)
public void setIntHeader(java.lang.String name, int value)
setIntHeader
在接口中 javax.servlet.http.HttpServletResponse
setIntHeader
在类中 javax.servlet.http.HttpServletResponseWrapper
HttpServletResponse.setIntHeader(java.lang.String, int)
public void setOnlyBuffering(boolean value)
This must be done before the first output is written. Buffering is needed to process elements that can not be written directly to the output stream because their sub - elements have to be processed separately. Which is so far true only for JSP pages.
If buffering is on, nothing is written to the output stream even if streaming for this response is enabled.
value
- the value to set