Class CmsFlexResponse
- All Implemented Interfaces:
javax.servlet.http.HttpServletResponse,javax.servlet.ServletResponse
This class wraps the standard HttpServletResponse so that it's output can be delivered to the CmsFlexCache.
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charThe cache delimiter char.protected static final org.apache.commons.logging.LogThe log object for this class.static final StringPrefix for permanent redirect targets.static final StringStatic string to indicate a header is "set" in the header maps.Fields inherited from interface javax.servlet.http.HttpServletResponse
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 -
Constructor Summary
ConstructorsConstructorDescriptionCmsFlexResponse(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. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCookie(javax.servlet.http.Cookie cookie) Method overloaded from the standard HttpServletRequest API.voidaddDateHeader(String name, long date) Method overload from the standard HttpServletRequest API.voidMethod overload from the standard HttpServletRequest API.voidaddIntHeader(String name, int value) Method overload from the standard HttpServletRequest API.voidAdds an inclusion target to the list of include results.voidReturns the value of the encoding used for this response.Provides access to the header cache of the top wrapper.javax.servlet.ServletOutputStreamMethod overload from the standard HttpServletRequest API.Method overload from the standard HttpServletRequest API.byte[]Returns the bytes that have been written on the current writers output stream.booleanThis flag indicates if the response is suspended or not.booleanReturnstrueif this response has been constructed for the top level element of this request,falseif it was constructed for an included sub-element.static voidprocessHeaders(Map<String, List<String>> headers, javax.servlet.http.HttpServletResponse res) Process the headers stored in the provided map and add them to the response.static voidprocessHeaders(Map<String, List<String>> headers, javax.servlet.http.HttpServletResponse res, boolean top) Process the headers stored in the provided map and add them to the response.voidsendRedirect(String location) Method overload from the standard HttpServletRequest API.voidsendRedirect(String location, boolean permanent) Internal redirect method used to handle both temporary and permanent redirects.voidsetContentType(String type) Method overload from the standard HttpServletRequest API.voidsetDateHeader(String name, long date) Method overload from the standard HttpServletRequest API.voidMethod overload from the standard HttpServletRequest API.voidsetIntHeader(String name, int value) Method overload from the standard HttpServletRequest API.voidsetOnlyBuffering(boolean value) Sets buffering status of the response.Methods inherited from class javax.servlet.http.HttpServletResponseWrapper
containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, getHeader, getHeaderNames, getHeaders, getStatus, getTrailerFields, sendError, sendError, setStatus, setStatus, setTrailerFieldsMethods inherited from class javax.servlet.ServletResponseWrapper
getBufferSize, getCharacterEncoding, getContentType, getLocale, getResponse, isCommitted, isWrapperFor, isWrapperFor, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentLengthLong, setLocale, setResponseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.servlet.ServletResponse
getBufferSize, getCharacterEncoding, getContentType, getLocale, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentLengthLong, setLocale
-
Field Details
-
FLEX_CACHE_DELIMITER
The cache delimiter char.- See Also:
-
PREFIX_PERMANENT_REDIRECT
Prefix for permanent redirect targets.- See Also:
-
SET_HEADER
Static string to indicate a header is "set" in the header maps.- See Also:
-
LOG
The log object for this class.
-
-
Constructor Details
-
CmsFlexResponse
Constructor for the CmsFlexResponse, this variation one is usually used to wrap responses for further include calls in OpenCms.- Parameters:
res- the CmsFlexResponse to wrapcontroller- the controller to use
-
CmsFlexResponse
public 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.- Parameters:
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 cascade
-
-
Method Details
-
processHeaders
public static void processHeaders(Map<String, List<String>> headers, javax.servlet.http.HttpServletResponse res) Process the headers stored in the provided map and add them to the response.- Parameters:
headers- the headers to addres- the response to add the headers to
-
processHeaders
public static void processHeaders(Map<String, List<String>> headers, javax.servlet.http.HttpServletResponse res, boolean top) Process the headers stored in the provided map and add them to the response.- Parameters:
headers- the headers to addres- the response to add the headers totop- true if we are at the top of the JSP processing stack
-
addCookie
Method overloaded from the standard HttpServletRequest API.Cookies must be set directly as a header, otherwise they might not be set in the super class.
- Specified by:
addCookiein interfacejavax.servlet.http.HttpServletResponse- Overrides:
addCookiein classjavax.servlet.http.HttpServletResponseWrapper- See Also:
-
addDateHeader
Method overload from the standard HttpServletRequest API.- Specified by:
addDateHeaderin interfacejavax.servlet.http.HttpServletResponse- Overrides:
addDateHeaderin classjavax.servlet.http.HttpServletResponseWrapper- See Also:
-
addHeader
Method overload from the standard HttpServletRequest API.- Specified by:
addHeaderin interfacejavax.servlet.http.HttpServletResponse- Overrides:
addHeaderin classjavax.servlet.http.HttpServletResponseWrapper- See Also:
-
addIntHeader
Method overload from the standard HttpServletRequest API.- Specified by:
addIntHeaderin interfacejavax.servlet.http.HttpServletResponse- Overrides:
addIntHeaderin classjavax.servlet.http.HttpServletResponseWrapper- See Also:
-
addToIncludeList
public void addToIncludeList(String target, Map<String, String[]> parameterMap, Map<String, Object> attributeMap) Adds an inclusion target to the list of include results.Should be used only in inclusion-scenarios like the JSP cms:include tag processing.
- Parameters:
target- the include target name to addparameterMap- the map of parameters given with the include commandattributeMap- the map of attributes given with the include command
-
flushBuffer
- Specified by:
flushBufferin interfacejavax.servlet.ServletResponse- Overrides:
flushBufferin classjavax.servlet.ServletResponseWrapper- Throws:
IOException- See Also:
-
getEncoding
Returns the value of the encoding used for this response.- Returns:
- the value of the encoding used for this response
-
getHeaders
Provides access to the header cache of the top wrapper.- Returns:
- the Map of cached headers
-
getOutputStream
Method overload from the standard HttpServletRequest API.- Specified by:
getOutputStreamin interfacejavax.servlet.ServletResponse- Overrides:
getOutputStreamin classjavax.servlet.ServletResponseWrapper- Throws:
IOException- See Also:
-
getWriter
Method overload from the standard HttpServletRequest API.- Specified by:
getWriterin interfacejavax.servlet.ServletResponse- Overrides:
getWriterin classjavax.servlet.ServletResponseWrapper- Throws:
IOException- See Also:
-
getWriterBytes
Returns the bytes that have been written on the current writers output stream.- Returns:
- the bytes that have been written on the current writers output stream
-
isSuspended
This flag indicates if the response is suspended or not.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.
- Returns:
- true if the response is suspended, false otherwise
-
isTopElement
Returnstrueif this response has been constructed for the top level element of this request,falseif it was constructed for an included sub-element.- Returns:
trueif this response has been constructed for the top level element of this request,falseif it was constructed for an included sub-element.
-
sendRedirect
Method overload from the standard HttpServletRequest API.- Specified by:
sendRedirectin interfacejavax.servlet.http.HttpServletResponse- Overrides:
sendRedirectin classjavax.servlet.http.HttpServletResponseWrapper- Throws:
IllegalArgumentException- In case of a malformed location stringIOException- See Also:
-
sendRedirect
Internal redirect method used to handle both temporary and permanent redirects.- Parameters:
location- the redirect targetpermanent- true for a permanent redirect, false for a temporary one- Throws:
IOException- if IO operations on the response fail
-
setContentType
Method overload from the standard HttpServletRequest API.- Specified by:
setContentTypein interfacejavax.servlet.ServletResponse- Overrides:
setContentTypein classjavax.servlet.ServletResponseWrapper- See Also:
-
setDateHeader
Method overload from the standard HttpServletRequest API.- Specified by:
setDateHeaderin interfacejavax.servlet.http.HttpServletResponse- Overrides:
setDateHeaderin classjavax.servlet.http.HttpServletResponseWrapper- See Also:
-
setHeader
Method overload from the standard HttpServletRequest API.- Specified by:
setHeaderin interfacejavax.servlet.http.HttpServletResponse- Overrides:
setHeaderin classjavax.servlet.http.HttpServletResponseWrapper- See Also:
-
setIntHeader
Method overload from the standard HttpServletRequest API.- Specified by:
setIntHeaderin interfacejavax.servlet.http.HttpServletResponse- Overrides:
setIntHeaderin classjavax.servlet.http.HttpServletResponseWrapper- See Also:
-
setOnlyBuffering
Sets buffering status of the response.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.
- Parameters:
value- the value to set
-