org.apache.struts2.portlet.context
Class PortletActionContext

java.lang.Object
  extended by org.apache.struts2.portlet.context.PortletActionContext
All Implemented Interfaces:
PortletActionConstants

public class PortletActionContext
extends java.lang.Object
implements PortletActionConstants

PortletActionContext. ActionContext thread local for the portlet environment.

Version:
$Revision: 724030 $ $Date: 2008-12-06 20:32:29 +0100 (Sat, 06 Dec 2008) $

Field Summary
 
Fields inherited from interface org.apache.struts2.portlet.PortletActionConstants
ACTION_MAPPING, ACTION_PARAM, ACTION_RESET, DEFAULT_ACTION_FOR_MODE, DEFAULT_ACTION_NAME, DEFAULT_DISPATCHER_SERVLET_NAME, DISPATCH_TO, ERROR_ACTION, EVENT_ACTION, EVENT_PHASE, MODE_NAMESPACE_MAP, MODE_PARAM, PHASE, PORTLET_CONFIG, PORTLET_NAMESPACE, RENDER_DIRECT_LOCATION, RENDER_PHASE, REQUEST, RESPONSE, STACK_FROM_EVENT_PHASE
 
Constructor Summary
PortletActionContext()
           
 
Method Summary
static ActionMapping getActionMapping()
          Gets the action mapping for this context
static javax.portlet.ActionRequest getActionRequest()
          Get the ActionRequest.
static javax.portlet.ActionResponse getActionResponse()
          Get the ActionRequest.
static ActionMapping getDefaultActionForMode()
          Get the default action mapping for the current mode.
static java.util.Map getModeNamespaceMap()
          Get the namespace to mode mappings.
static java.lang.Integer getPhase()
          Get the phase that the portlet is executing in.
static javax.portlet.PortletConfig getPortletConfig()
          Get the PortletConfig of the portlet that is executing.
static javax.portlet.PortletContext getPortletContext()
          Get the portlet context.
static java.lang.String getPortletNamespace()
          Get the action namespace of the portlet.
static javax.portlet.RenderRequest getRenderRequest()
          Get the RenderRequest.
static javax.portlet.RenderResponse getRenderResponse()
          Get the RenderResponse.
static javax.portlet.PortletRequest getRequest()
          Get the current PortletRequest.
static javax.portlet.PortletResponse getResponse()
          Get the current PortletResponse
static boolean isEvent()
           
static boolean isPortletRequest()
          Check to see if the current request is a portlet request.
static boolean isRender()
           
static void setPortletContext(javax.portlet.PortletContext context)
          Convenience setter for the portlet context.
static void setRequest(javax.portlet.PortletRequest request)
          Convenience setter for the portlet request.
static void setResponse(javax.portlet.PortletResponse response)
          Convenience setter for the portlet response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletActionContext

public PortletActionContext()
Method Detail

getPortletConfig

public static javax.portlet.PortletConfig getPortletConfig()
Get the PortletConfig of the portlet that is executing.

Returns:
The PortletConfig of the executing portlet.

getRenderRequest

public static javax.portlet.RenderRequest getRenderRequest()
Get the RenderRequest. Can only be invoked in the render phase.

Returns:
The current RenderRequest.
Throws:
java.lang.IllegalStateException - If the method is invoked in the wrong phase.

getRenderResponse

public static javax.portlet.RenderResponse getRenderResponse()
Get the RenderResponse. Can only be invoked in the render phase.

Returns:
The current RenderResponse.
Throws:
java.lang.IllegalStateException - If the method is invoked in the wrong phase.

getActionRequest

public static javax.portlet.ActionRequest getActionRequest()
Get the ActionRequest. Can only be invoked in the event phase.

Returns:
The current ActionRequest.
Throws:
java.lang.IllegalStateException - If the method is invoked in the wrong phase.

getActionResponse

public static javax.portlet.ActionResponse getActionResponse()
Get the ActionRequest. Can only be invoked in the event phase.

Returns:
The current ActionRequest.
Throws:
java.lang.IllegalStateException - If the method is invoked in the wrong phase.

getPortletNamespace

public static java.lang.String getPortletNamespace()
Get the action namespace of the portlet. Used to organize actions for multiple portlets in the same portlet application.

Returns:
The portlet namespace as defined in portlet.xml and struts.xml

getRequest

public static javax.portlet.PortletRequest getRequest()
Get the current PortletRequest.

Returns:
The current PortletRequest.

setRequest

public static void setRequest(javax.portlet.PortletRequest request)
Convenience setter for the portlet request.

Parameters:
request -

getResponse

public static javax.portlet.PortletResponse getResponse()
Get the current PortletResponse

Returns:
The current PortletResponse.

setResponse

public static void setResponse(javax.portlet.PortletResponse response)
Convenience setter for the portlet response.

Parameters:
response -

getPhase

public static java.lang.Integer getPhase()
Get the phase that the portlet is executing in.

Returns:
PortletActionConstants.RENDER_PHASE in render phase, and PortletActionConstants.EVENT_PHASE in the event phase.

isRender

public static boolean isRender()
Returns:
true if the Portlet is executing in render phase.

isEvent

public static boolean isEvent()
Returns:
true if the Portlet is executing in the event phase.

isPortletRequest

public static boolean isPortletRequest()
Check to see if the current request is a portlet request.

Returns:
true if the current request is a portlet request.

getDefaultActionForMode

public static ActionMapping getDefaultActionForMode()
Get the default action mapping for the current mode.

Returns:
The default action mapping for the current portlet mode.

getModeNamespaceMap

public static java.util.Map getModeNamespaceMap()
Get the namespace to mode mappings.

Returns:
The map of the namespaces for each mode.

getPortletContext

public static javax.portlet.PortletContext getPortletContext()
Get the portlet context.

Returns:
The portlet context.

setPortletContext

public static void setPortletContext(javax.portlet.PortletContext context)
Convenience setter for the portlet context.

Parameters:
context -

getActionMapping

public static ActionMapping getActionMapping()
Gets the action mapping for this context

Returns:
The action mapping


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.