org.apache.struts2.portlet.context
Class PortletActionContext

java.lang.Object
  extended by org.apache.struts2.portlet.context.PortletActionContext

public class PortletActionContext
extends java.lang.Object

PortletActionContext. ActionContext thread local for the portlet environment.

Version:
$Revision: 564279 $ $Date: 2007-08-09 19:00:49 +0200 (Thu, 09 Aug 2007) $

Constructor Summary
PortletActionContext()
           
 
Method Summary
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 isAction()
           
static boolean isEvent()
           
static boolean isJSR268Supported()
          Whether JSR286 features are supported.
static boolean isPortletRequest()
          Check to see if the current request is a portlet request.
static boolean isRender()
           
static boolean isResource()
           
 
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.

getResponse

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

Returns:
The current PortletResponse.

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#ACTION_PHASE in the event phase.

isRender

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

isAction

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

isResource

public static boolean isResource()
Returns:
true if the Portlet is executing in the resource 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.

isEvent

public static boolean isEvent()

isJSR268Supported

public static boolean isJSR268Supported()
Whether JSR286 features are supported.

Returns:
true if PortletContext.getMajorVersion() returns a value greater than 1


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