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 Object
implements PortletActionConstants

PortletActionContext. ActionContext thread local for the portlet environment.

Version:
$Revision: 568895 $ $Date: 2007-08-23 10:57:36 +0200 (Do, 23. Aug 2007) $

Field Summary
 
Fields inherited from interface org.apache.struts2.portlet.PortletActionConstants
ACTION_PARAM, ACTION_RESET, DEFAULT_ACTION_FOR_MODE, DEFAULT_ACTION_NAME, DEFAULT_DISPATCHER_SERVLET_NAME, 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 javax.portlet.ActionRequest getActionRequest()
          Get the ActionRequest.
static javax.portlet.ActionResponse getActionResponse()
          Get the ActionRequest.
private static ActionContext getContext()
           
static ActionMapping getDefaultActionForMode()
          Get the default action mapping for the current mode.
static Map getModeNamespaceMap()
          Get the namespace to mode mappings.
static 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 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()
           
 
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:
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:
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:
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:
IllegalStateException - If the method is invoked in the wrong phase.

getPortletNamespace

public static 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.

getResponse

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

Returns:
The current PortletResponse.

getPhase

public static 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.

getContext

private static ActionContext getContext()
Returns:
The current ActionContext.

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 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.


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