org.apache.struts2.portlet.context

## Class PortletActionContext

- java.lang.Object
- - org.apache.struts2.portlet.context.PortletActionContext

-     public class PortletActionContext
      extends 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

    Constructors
    Constructor and Description
    `PortletActionContext()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 Map<javax.portlet.PortletMode,ActionMapping>` | `getModeActionMap()` Get the mode to default action mappings.
    `static Map<javax.portlet.PortletMode,String>` | `getModeNamespaceMap()` Get the namespace to mode mappings.
    `static PortletPhase` | `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.ResourceResponse` | `getResourceResponse()` Get the ResourceResponse.
    `static javax.portlet.PortletResponse` | `getResponse()` Get the current PortletResponse
    `static boolean` | `isJSR268Supported()` Whether JSR286 features are supported.
    `static boolean` | `isPortletRequest()` Check to see if the current request is a portlet request.

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

    - #### getResourceResponse

          public static javax.portlet.ResourceResponse getResourceResponse()

      Get the ResourceResponse. Can only be invoked in the resource phase.
      Returns:
        The current ResourceResponse.
      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 PortletPhase getPhase()

      Get the phase that the portlet is executing in.
      Returns:
        `PortletPhase.RENDER_PHASE` in render phase, and `PortletPhase.ACTION_PHASE` 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 Map<javax.portlet.PortletMode,String> getModeNamespaceMap()

      Get the namespace to mode mappings.
      Returns:
        The map of the namespaces for each mode.

    - #### getModeActionMap

          public static Map<javax.portlet.PortletMode,ActionMapping> getModeActionMap()

      Get the mode to default action mappings.
      Returns:
        The map of default action mapping for each mode

    - #### getPortletContext

          public static javax.portlet.PortletContext getPortletContext()

      Get the portlet context.
      Returns:
        The portlet context.

    - #### isJSR268Supported

          public static boolean isJSR268Supported()

      Whether JSR286 features are supported.
      Returns:
        `true` if `PortletContext.getMajorVersion()` returns a value greater than 1

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.