public class PortletExternalContext extends java.lang.Object implements ExternalContext
Modifier and Type | Field and Description |
---|---|
protected static short |
ACTION_PHASE |
protected static short |
RENDER_PHASE |
protected static short |
RESOURCE_PHASE |
Constructor and Description |
---|
PortletExternalContext(javax.portlet.PortletContext context,
javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response)
Create a new external context wrapping given portlet action request and response and given portlet context.
|
PortletExternalContext(javax.portlet.PortletContext context,
javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response,
FlowUrlHandler flowUrlHandler)
Create a new external context wrapping given portlet action request and response and given portlet context.
|
Modifier and Type | Method and Description |
---|---|
SharedAttributeMap<java.lang.Object> |
getApplicationMap()
Provides access to the external application map, providing a storage for data local to the current user
application and accessible to both internal and external SWF artifacts.
|
java.lang.String |
getContextPath()
Returns the logical path to the application hosting this external context.
|
java.security.Principal |
getCurrentUser()
Provides access to the user's principal security object.
|
boolean |
getExternalRedirectRequested()
Returns the flag indicating if an external redirect response has been requested by the flow.
|
java.lang.String |
getExternalRedirectUrl()
Returns the URL to redirect to.
|
boolean |
getFlowDefinitionRedirectRequested()
Returns the flag indicating if a flow definition redirect response has been requested by the flow.
|
boolean |
getFlowExecutionRedirectRequested()
Returns the flag indicating if a flow execution redirect response has been requested by the flow.
|
java.lang.String |
getFlowExecutionUrl(java.lang.String flowId,
java.lang.String flowExecutionKey)
Get a flow execution URL for the execution with the provided key.
|
java.lang.String |
getFlowRedirectFlowId()
Returns the id of the flow definition to redirect to.
|
MutableAttributeMap<java.lang.Object> |
getFlowRedirectFlowInput()
Returns the input to pass the flow definition through the redirect.
|
SharedAttributeMap<java.lang.Object> |
getGlobalSessionMap()
Provides access to the global external session map, providing a storage for data globally accross the user
session and accessible to both internal and external SWF artifacts.
|
java.util.Locale |
getLocale()
Returns the client locale.
|
java.lang.Object |
getNativeContext()
Provides access to the context object for the current environment.
|
java.lang.Object |
getNativeRequest()
Provides access to the request object for the current environment.
|
java.lang.Object |
getNativeResponse()
Provides access to the response object for the current environment.
|
boolean |
getRedirectInPopup()
If a redirect response has been requested, indicates if the redirect should be issued from a popup dialog.
|
MutableAttributeMap<java.lang.Object> |
getRequestMap()
Provides access to the external request attribute map, providing a storage for data local to the current user
request and accessible to both internal and external SWF artifacts.
|
ParameterMap |
getRequestParameterMap()
Provides access to the parameters associated with the user request that led to SWF being called.
|
java.io.Writer |
getResponseWriter()
Get a writer for writing out a response.
|
SharedAttributeMap<java.lang.Object> |
getSessionMap()
Provides access to the external session map, providing a storage for data local to the current user session and
accessible to both internal and external SWF artifacts.
|
boolean |
isActionPhase()
Returns true if the current request phase is the action phase
|
boolean |
isAjaxRequest()
Returns true if the current request is an asynchronous Ajax request.
|
boolean |
isRenderPhase()
Returns true if the current request phase is the render phase
|
boolean |
isResourcePhase()
Returns true if the current request phase is the resource phase
|
boolean |
isResponseAllowed()
Is a render response allowed to be written for this request? Always return false after a response has been
completed.
|
boolean |
isResponseComplete()
Has the response been completed? Response complete status can be achieved by:
Writing out the response and calling
ExternalContext.recordResponseComplete() , or
Calling one of the redirect request methods
|
boolean |
isResponseCompleteFlowExecutionRedirect()
Returns true if the response has been completed with flow execution redirect request.
|
void |
recordResponseComplete()
Called by flow artifacts such as View states and end states to indicate they handled the response, typically by
writing out content to the response stream.
|
void |
requestExternalRedirect(java.lang.String uri)
Request a redirect to an arbitrary resource location.
|
void |
requestFlowDefinitionRedirect(java.lang.String flowId,
MutableAttributeMap<?> input)
Request that a flow definition redirect be performed by the calling environment.
|
void |
requestFlowExecutionRedirect()
Request that a flow execution redirect be performed by the calling environment.
|
void |
requestRedirectInPopup()
Request that the current redirect requested be sent to the client in a manner that causes the client to issue the
redirect from a popup dialog.
|
protected static final short ACTION_PHASE
protected static final short RENDER_PHASE
protected static final short RESOURCE_PHASE
public PortletExternalContext(javax.portlet.PortletContext context, javax.portlet.PortletRequest request, javax.portlet.PortletResponse response)
context
- the portal contextrequest
- the portlet requestresponse
- the portlet responsepublic PortletExternalContext(javax.portlet.PortletContext context, javax.portlet.PortletRequest request, javax.portlet.PortletResponse response, FlowUrlHandler flowUrlHandler)
context
- the portal contextrequest
- the portlet requestresponse
- the portlet responseflowUrlHandler
- the flow url handlerpublic java.lang.String getContextPath()
ExternalContext
getContextPath
in interface ExternalContext
public ParameterMap getRequestParameterMap()
ExternalContext
getRequestParameterMap
in interface ExternalContext
public MutableAttributeMap<java.lang.Object> getRequestMap()
ExternalContext
getRequestMap
in interface ExternalContext
public SharedAttributeMap<java.lang.Object> getSessionMap()
ExternalContext
getSessionMap
in interface ExternalContext
public SharedAttributeMap<java.lang.Object> getGlobalSessionMap()
ExternalContext
Note: most external context implementations do not distinguish between the concept of a "local" user session
scope and a "global" session scope. The Portlet world does, but not the Servlet for example. In those cases
calling this method returns the same map as calling ExternalContext.getSessionMap()
.
getGlobalSessionMap
in interface ExternalContext
public SharedAttributeMap<java.lang.Object> getApplicationMap()
ExternalContext
getApplicationMap
in interface ExternalContext
public java.security.Principal getCurrentUser()
ExternalContext
getCurrentUser
in interface ExternalContext
public java.util.Locale getLocale()
ExternalContext
getLocale
in interface ExternalContext
public java.lang.Object getNativeContext()
ExternalContext
getNativeContext
in interface ExternalContext
public java.lang.Object getNativeRequest()
ExternalContext
getNativeRequest
in interface ExternalContext
public java.lang.Object getNativeResponse()
ExternalContext
getNativeResponse
in interface ExternalContext
public boolean isAjaxRequest()
ExternalContext
isAjaxRequest
in interface ExternalContext
public java.lang.String getFlowExecutionUrl(java.lang.String flowId, java.lang.String flowExecutionKey)
ExternalContext
getFlowExecutionUrl
in interface ExternalContext
flowId
- the flow definition idflowExecutionKey
- the flow execution keypublic java.io.Writer getResponseWriter() throws java.lang.IllegalStateException
ExternalContext
getResponseWriter
in interface ExternalContext
java.lang.IllegalStateException
- if the response has completed or is not allowedpublic boolean isResponseAllowed()
ExternalContext
isResponseAllowed
in interface ExternalContext
public boolean isResponseComplete()
ExternalContext
ExternalContext.recordResponseComplete()
, or
isResponseComplete
in interface ExternalContext
ExternalContext.getResponseWriter()
,
ExternalContext.recordResponseComplete()
,
ExternalContext.requestFlowExecutionRedirect()
,
ExternalContext.requestFlowDefinitionRedirect(String, MutableAttributeMap)
,
ExternalContext.requestExternalRedirect(String)
public void recordResponseComplete()
ExternalContext
recordResponseComplete
in interface ExternalContext
public boolean isResponseCompleteFlowExecutionRedirect()
ExternalContext
isResponseCompleteFlowExecutionRedirect
in interface ExternalContext
ExternalContext.isResponseComplete()
,
ExternalContext.requestFlowExecutionRedirect()
public void requestFlowExecutionRedirect() throws java.lang.IllegalStateException
ExternalContext
requestFlowExecutionRedirect
in interface ExternalContext
java.lang.IllegalStateException
- if the response has completedExternalContext.isResponseComplete()
public void requestFlowDefinitionRedirect(java.lang.String flowId, MutableAttributeMap<?> input) throws java.lang.IllegalStateException
ExternalContext
requestFlowDefinitionRedirect
in interface ExternalContext
flowId
- the id of the flow definition to redirect toinput
- input to pass the flow; this input is generally encoded the url to launch the flowjava.lang.IllegalStateException
- if the response has completedExternalContext.isResponseComplete()
public void requestExternalRedirect(java.lang.String uri) throws java.lang.IllegalStateException
ExternalContext
requestExternalRedirect
in interface ExternalContext
uri
- the location of the resource to redirect tojava.lang.IllegalStateException
- if the response has completedExternalContext.isResponseComplete()
public void requestRedirectInPopup() throws java.lang.IllegalStateException
ExternalContext
requestRedirectInPopup
in interface ExternalContext
java.lang.IllegalStateException
- if a redirect has not been requestedExternalContext.requestFlowExecutionRedirect()
,
ExternalContext.requestFlowDefinitionRedirect(String, MutableAttributeMap)
,
ExternalContext.requestExternalRedirect(String)
public boolean getFlowExecutionRedirectRequested()
public boolean getFlowDefinitionRedirectRequested()
public java.lang.String getFlowRedirectFlowId()
getFlowDefinitionRedirectRequested()
returns true.public MutableAttributeMap<java.lang.Object> getFlowRedirectFlowInput()
getFlowDefinitionRedirectRequested()
returns true.public boolean getExternalRedirectRequested()
public java.lang.String getExternalRedirectUrl()
getExternalRedirectRequested()
returns true.public boolean getRedirectInPopup()
public boolean isActionPhase()
public boolean isRenderPhase()
public boolean isResourcePhase()