|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.ServletResponseWrapper
javax.servlet.http.HttpServletResponseWrapper
org.apache.pluto.internal.impl.PortletResponseImpl
org.apache.pluto.internal.impl.StateAwareResponseImpl
public class StateAwareResponseImpl
Implementation of JSR-286 StateAwareResponse
.
Field Summary | |
---|---|
protected PortalCallbackService |
callback
|
protected boolean |
redirected
|
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 | |
---|---|
StateAwareResponseImpl(PortletContainer container,
InternalPortletWindow internalPortletWindow,
javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse)
|
Method Summary | |
---|---|
void |
addDateHeader(String arg0,
long arg1)
|
void |
addHeader(String arg0,
String arg1)
|
void |
addIntHeader(String arg0,
int arg1)
|
void |
flushBuffer()
|
int |
getBufferSize()
|
PortletMode |
getChangedPortletMode()
|
WindowState |
getChangedWindowState()
|
String |
getCharacterEncoding()
|
String |
getContentType()
|
Locale |
getLocale()
|
javax.servlet.ServletOutputStream |
getOutputStream()
TODO: javadoc about why we are using a wrapped writer here. |
PortletMode |
getPortletMode()
Returns the currently set portlet mode on this reponse. |
Map<String,String[]> |
getPublicRenderParameter()
|
String |
getRedirectLocation()
|
Map<String,String[]> |
getRenderParameterMap()
Returns a Map of the render parameters currently set on
this response. |
Map |
getRenderParameters()
|
WindowState |
getWindowState()
Returns the currently set window state on this response. |
PrintWriter |
getWriter()
|
boolean |
isCommitted()
|
protected boolean |
isPortletModeAllowed(PortletMode mode)
|
protected boolean |
isPortletModeAllowedByPortal(PortletMode mode)
|
protected boolean |
isPortletModeAllowedByPortlet(PortletMode mode)
|
protected boolean |
isWindowStateAllowed(WindowState state)
|
void |
removePublicRenderParameter(String name)
Removes the specified public render parameter. |
void |
reset()
|
void |
resetBuffer()
|
void |
sendRedirect(String location)
|
void |
setBufferSize(int arg0)
|
void |
setCharacterEncoding(String arg0)
|
void |
setContentLength(int arg0)
|
void |
setContentType(String arg0)
|
void |
setDateHeader(String arg0,
long arg1)
|
void |
setEvent(QName qname,
Serializable value)
Publishes an Event with the given payload. |
void |
setEvent(String name,
Serializable value)
Publishes an Event with the given payload in the default namespace. |
void |
setHeader(String arg0,
String arg1)
|
void |
setIntHeader(String arg0,
int arg1)
|
void |
setLocale(Locale arg0)
|
void |
setNextPossiblePortletModes(Enumeration portletModes)
|
void |
setPortletMode(PortletMode portletMode)
Sets the portlet mode of a portlet to the given portlet mode. |
void |
setRenderParameter(String key,
String value)
Sets a String parameter for the render request. |
void |
setRenderParameter(String key,
String[] values)
Sets a String array parameter for the render request. |
void |
setRenderParameters(Map<String,String[]> parameters)
Sets a parameter map for the render request. |
void |
setStatus(int arg0)
|
void |
setStatus(int arg0,
String arg1)
|
void |
setWindowState(WindowState windowState)
Sets the window state of a portlet to the given window state. |
Methods inherited from class org.apache.pluto.internal.impl.PortletResponseImpl |
---|
addCookie, addProperty, addProperty, addProperty, addProperty, containsHeader, createActionURL, createElement, createRenderURL, createResourceURL, createResourceURL, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, getContainer, getHttpServletRequest, getHttpServletResponse, getInternalPortletWindow, getNamespace, isForwarded, isIncluded, sendError, sendError, setForwarded, setIncluded, setProperty |
Methods inherited from class javax.servlet.ServletResponseWrapper |
---|
getResponse, setResponse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.portlet.PortletResponse |
---|
addProperty, addProperty, createElement, encodeURL, getNamespace, setProperty |
Field Detail |
---|
protected boolean redirected
protected PortalCallbackService callback
Constructor Detail |
---|
public StateAwareResponseImpl(PortletContainer container, InternalPortletWindow internalPortletWindow, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
Method Detail |
---|
public void setEvent(QName qname, Serializable value) throws IllegalArgumentException
StateAwareResponse
The object type of the value must be compliant with the specified event type in the portlet deployment descriptor.
The value must have a valid JAXB binding and be serializable.
setEvent
in interface StateAwareResponse
qname
- the event name to publish, must not be null
value
- the value of this event, must have a valid JAXB binding and
be serializable, or null
.
IllegalArgumentException
- if name is null
, the value is not
serializable, the value does not have a valid JAXB binding, the
object type of the value is not the same as specified in
the portlet deployment descriptor for this event name.public void setEvent(String name, Serializable value)
StateAwareResponse
The name is treated as local part of the event QName and the namespace
is either taken from the default-event-namespace
element
in the portlet deployment descriptor, or if this element is not provided
the XML default namespace XMLConstants.NULL_NS_URI is used.
The object type of the value must be compliant with the specified event type in the portlet deployment descriptor.
The value must have a valid JAXB binding and be serializable.
setEvent
in interface StateAwareResponse
name
- the local part of the event name to publish, must not be null
value
- the value of this event, must have a valid JAXB binding and
be serializable, or null
.public void sendRedirect(String location) throws IOException
sendRedirect
in interface javax.servlet.http.HttpServletResponse
sendRedirect
in class javax.servlet.http.HttpServletResponseWrapper
IOException
public String getRedirectLocation()
public void setWindowState(WindowState windowState) throws WindowStateException
StateAwareResponse
Possible values are the standard window states and any custom window states supported by the portal and the portlet. Standard window states are:
setWindowState
in interface StateAwareResponse
windowState
- the new portlet window state
WindowStateException
- if the portlet cannot switch to the specified window
state. To avoid this exception the portlet can check the
allowed window states with
Request.isWindowStateAllowed()
.WindowState
public void setPortletMode(PortletMode portletMode) throws PortletModeException
StateAwareResponse
Possible values are the standard portlet modes and any custom portlet modes supported by the portal and the portlet. Portlets must declare in the deployment descriptor the portlet modes they support for each markup type. Standard portlet modes are:
Note: The portlet may still be called in a different window state in the next render call, depending on the portlet container / portal.
setPortletMode
in interface StateAwareResponse
portletMode
- the new portlet mode
PortletModeException
- if the portlet cannot switch to this portlet mode, because
the portlet or portal does not support it for this markup,
or the current user is not allowed to switch to this
portlet mode. To avoid this exception the portlet can
check the allowed portlet modes with
Request.isPortletModeAllowed()
.public void setRenderParameters(Map<String,String[]> parameters)
StateAwareResponse
All previously set render parameters are cleared.
These parameters will be accessible in all sub-sequent render calls via
the PortletRequest.getParameter
call until a new request
is targeted to the portlet.
The given parameters do not need to be encoded prior to calling this method.
The portlet should not modify the map any further after calling this method.
setRenderParameters
in interface StateAwareResponse
parameters
- Map containing parameter names for the render phase as keys
and parameter values as map values. The keys in the parameter
map must be of type String. The values in the parameter map
must be of type String array (String[]
).public void setRenderParameter(String key, String value)
StateAwareResponse
These parameters will be accessible in all sub-sequent render calls via
the PortletRequest.getParameter
call until a request is
targeted to the portlet.
This method replaces all parameters with the given key.
The given parameter do not need to be encoded prior to calling this method.
setRenderParameter
in interface StateAwareResponse
key
- key of the render parametervalue
- value of the render parameterpublic void setRenderParameter(String key, String[] values)
StateAwareResponse
These parameters will be accessible in all sub-sequent render calls via
the PortletRequest.getParameter
call until a request is
targeted to the portlet.
This method replaces all parameters with the given key.
The given parameter do not need to be encoded prior to calling this method.
setRenderParameter
in interface StateAwareResponse
key
- key of the render parametervalues
- values of the render parameterpublic Map getRenderParameters()
public Map<String,String[]> getRenderParameterMap()
StateAwareResponse
Map
of the render parameters currently set on
this response.
The values in the returned Map
are from type String array (String[]
).
If no parameters exist this method returns an empty Map
.
getRenderParameterMap
in interface StateAwareResponse
Map
containing render parameter names as keys and
parameter values as map values, or an empty Map
if
no parameters exist. The keys in the parameter map are of type
String. The values in the parameter map are of type String array (String[]
).public Map<String,String[]> getPublicRenderParameter()
public PortletMode getChangedPortletMode()
public PortletMode getPortletMode()
StateAwareResponse
getPortletMode
in interface StateAwareResponse
null
if none is setpublic WindowState getChangedWindowState()
public WindowState getWindowState()
StateAwareResponse
getWindowState
in interface StateAwareResponse
null
if none is setprotected boolean isPortletModeAllowed(PortletMode mode)
protected boolean isPortletModeAllowedByPortlet(PortletMode mode)
protected boolean isPortletModeAllowedByPortal(PortletMode mode)
protected boolean isWindowStateAllowed(WindowState state)
public void setNextPossiblePortletModes(Enumeration portletModes)
public void reset()
reset
in interface javax.servlet.ServletResponse
reset
in class javax.servlet.ServletResponseWrapper
public void resetBuffer()
resetBuffer
in interface javax.servlet.ServletResponse
resetBuffer
in class javax.servlet.ServletResponseWrapper
public void setBufferSize(int arg0)
setBufferSize
in interface javax.servlet.ServletResponse
setBufferSize
in class javax.servlet.ServletResponseWrapper
public void setCharacterEncoding(String arg0)
setCharacterEncoding
in interface javax.servlet.ServletResponse
setCharacterEncoding
in class javax.servlet.ServletResponseWrapper
public void setContentLength(int arg0)
setContentLength
in interface javax.servlet.ServletResponse
setContentLength
in class javax.servlet.ServletResponseWrapper
public void setContentType(String arg0)
setContentType
in interface javax.servlet.ServletResponse
setContentType
in class javax.servlet.ServletResponseWrapper
public void setLocale(Locale arg0)
setLocale
in interface javax.servlet.ServletResponse
setLocale
in class javax.servlet.ServletResponseWrapper
public javax.servlet.ServletOutputStream getOutputStream() throws IllegalStateException, IOException
PortletResponseImpl
getOutputStream
in interface javax.servlet.ServletResponse
getOutputStream
in class PortletResponseImpl
IllegalStateException
IOException
PrintWriterServletOutputStream
public PrintWriter getWriter() throws IllegalStateException, IOException
getWriter
in interface javax.servlet.ServletResponse
getWriter
in class PortletResponseImpl
IllegalStateException
IOException
public void addDateHeader(String arg0, long arg1)
addDateHeader
in interface javax.servlet.http.HttpServletResponse
addDateHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void addHeader(String arg0, String arg1)
addHeader
in interface javax.servlet.http.HttpServletResponse
addHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void addIntHeader(String arg0, int arg1)
addIntHeader
in interface javax.servlet.http.HttpServletResponse
addIntHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void setStatus(int arg0, String arg1)
setStatus
in interface javax.servlet.http.HttpServletResponse
setStatus
in class javax.servlet.http.HttpServletResponseWrapper
public void setDateHeader(String arg0, long arg1)
setDateHeader
in interface javax.servlet.http.HttpServletResponse
setDateHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void setHeader(String arg0, String arg1)
setHeader
in interface javax.servlet.http.HttpServletResponse
setHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void setIntHeader(String arg0, int arg1)
setIntHeader
in interface javax.servlet.http.HttpServletResponse
setIntHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void setStatus(int arg0)
setStatus
in interface javax.servlet.http.HttpServletResponse
setStatus
in class javax.servlet.http.HttpServletResponseWrapper
public void flushBuffer() throws IOException
flushBuffer
in interface javax.servlet.ServletResponse
flushBuffer
in class javax.servlet.ServletResponseWrapper
IOException
public int getBufferSize()
getBufferSize
in interface javax.servlet.ServletResponse
getBufferSize
in class javax.servlet.ServletResponseWrapper
public String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletResponse
getCharacterEncoding
in class javax.servlet.ServletResponseWrapper
public String getContentType()
getContentType
in interface javax.servlet.ServletResponse
getContentType
in class javax.servlet.ServletResponseWrapper
public Locale getLocale()
getLocale
in interface javax.servlet.ServletResponse
getLocale
in class javax.servlet.ServletResponseWrapper
public boolean isCommitted()
isCommitted
in interface javax.servlet.ServletResponse
isCommitted
in class javax.servlet.ServletResponseWrapper
public void removePublicRenderParameter(String name)
StateAwareResponse
public-render-parameter
element with the
identifier
mapping to the parameter name.
removePublicRenderParameter
in interface StateAwareResponse
name
- a String
specifying
the name of the public render parameter to be removed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |