com.opensymphony.xwork2

## Class ActionContext

- java.lang.Object
- - org.apache.struts2.ActionContext
  - - com.opensymphony.xwork2.ActionContext

- All Implemented Interfaces:
    Serializable

  Deprecated.
  since 6.7.0, use `ActionContext` instead.

      @Deprecated
      public class ActionContext
      extends ActionContext

  The ActionContext is the context in which an `Action` is executed. Each context is basically a container of objects an action needs for execution like the session, parameters, locale, etc.

  The ActionContext is thread local which means that values stored in the ActionContext are unique per thread. See the `ThreadLocal` class for more information. The benefit of this is you don't need to worry about a user specific action context, you just get it:

  `ActionContext context = ActionContext.getContext();`

  Finally, because of the thread local usage you don't need to worry about making your actions thread safe.

  See Also:
    Serialized Form

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ActionContext` | `adapt(ActionContext actualContext)` Deprecated.
    `ActionContext` | `bind()` Deprecated. Binds this context with the current thread
    `static ActionContext` | `bind(ActionContext actionContext)` Deprecated.
    `static void` | `clear()` Deprecated.
    `static boolean` | `containsValueStack(Map<String,Object> context)` Deprecated.
    `Object` | `get(String key)` Deprecated. Returns a value that is stored in the current ActionContext by doing a lookup using the value's key.
    `ActionInvocation` | `getActionInvocation()` Deprecated. Gets the action invocation (the execution state).
    `ActionMapping` | `getActionMapping()` Deprecated. Gets ActionMapping associated with current action
    `String` | `getActionName()` Deprecated. Gets the name of the current Action.
    `Map<String,Object>` | `getApplication()` Deprecated. Returns a Map of the ServletContext when in a servlet environment or a generic application level Map otherwise.
    `Container` | `getContainer()` Deprecated. Sets the container for this request
    `static ActionContext` | `getContext()` Deprecated.
    `Map<String,Object>` | `getContextMap()` Deprecated. Gets the context map.
    `Map<String,ConversionData>` | `getConversionErrors()` Deprecated. Gets the map of conversion errors which occurred when executing the action.
    `<T> T` | `getInstance(Class<T> type)` Deprecated.
    `Locale` | `getLocale()` Deprecated. Gets the Locale of the current action.
    `javax.servlet.jsp.PageContext` | `getPageContext()` Deprecated. Gets PageContext associated with current action
    `HttpParameters` | `getParameters()` Deprecated. Returns a Map of the HttpServletRequest parameters when in a servlet environment or a generic Map of parameters otherwise.
    `javax.servlet.ServletContext` | `getServletContext()` Deprecated. Gets ServletContext associated with current action
    `javax.servlet.http.HttpServletRequest` | `getServletRequest()` Deprecated. Gets ServletRequest associated with current action
    `javax.servlet.http.HttpServletResponse` | `getServletResponse()` Deprecated. Gets ServletResponse associated with current action
    `Map<String,Object>` | `getSession()` Deprecated. Gets the Map of HttpSession values when in a servlet environment or a generic session map otherwise.
    `ValueStack` | `getValueStack()` Deprecated. Gets the OGNL value stack.
    `static ActionContext` | `of()` Deprecated.
    `static ActionContext` | `of(Map<String,Object> context)` Deprecated.
    `void` | `put(String key, Object value)` Deprecated. Stores a value in the current ActionContext.
    `ActionContext` | `with(String key, Object value)` Deprecated. Adds arbitrary key to action context
    `ActionContext` | `withActionInvocation(ActionInvocation actionInvocation)` Deprecated.
    `ActionContext` | `withActionInvocation(ActionInvocation actionInvocation)` Deprecated. Sets the action invocation (the execution state).
    `ActionContext` | `withActionMapping(ActionMapping actionMapping)` Deprecated. Assigns ActionMapping to action context
    `ActionContext` | `withActionName(String actionName)` Deprecated. Sets the name of the current Action in the ActionContext.
    `ActionContext` | `withApplication(Map<String,Object> application)` Deprecated. Sets the action's application context.
    `ActionContext` | `withContainer(Container container)` Deprecated. Gets the container for this request
    `ActionContext` | `withConversionErrors(Map<String,ConversionData> conversionErrors)` Deprecated. Sets conversion errors which occurred when executing the action.
    `ActionContext` | `withExtraContext(Map<String,Object> extraContext)` Deprecated. Assigns an extra context map to action context
    `ActionContext` | `withLocale(Locale locale)` Deprecated. Sets the Locale for the current action.
    `ActionContext` | `withPageContext(javax.servlet.jsp.PageContext pageContext)` Deprecated. Assigns PageContext to action context
    `ActionContext` | `withParameters(HttpParameters parameters)` Deprecated. Sets the action parameters.
    `ActionContext` | `withServletContext(javax.servlet.ServletContext servletContext)` Deprecated. Assigns ServletContext to action context
    `ActionContext` | `withServletRequest(javax.servlet.http.HttpServletRequest request)` Deprecated. Assigns ServletRequest to action context
    `ActionContext` | `withServletResponse(javax.servlet.http.HttpServletResponse response)` Deprecated. Assigns ServletResponse to action context
    `ActionContext` | `withSession(Map<String,Object> session)` Deprecated. Sets a map of action session values.
    `ActionContext` | `withValueStack(ValueStack valueStack)` Deprecated.
    `ActionContext` | `withValueStack(ValueStack valueStack)` Deprecated. Sets the OGNL value stack.

    - ### Methods inherited from class org.apache.struts2.ActionContext

      `equals, hashCode`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### adapt

          public static ActionContext adapt(ActionContext actualContext)

      Deprecated.

    - #### of

          public static ActionContext of(Map<String,Object> context)

      Deprecated.

    - #### of

          public static ActionContext of()

      Deprecated.

    - #### bind

          public static ActionContext bind(ActionContext actionContext)

      Deprecated.

    - #### containsValueStack

          public static boolean containsValueStack(Map<String,Object> context)

      Deprecated.

    - #### clear

          public static void clear()

      Deprecated.

    - #### getContext

          public static ActionContext getContext()

      Deprecated.

    - #### bind

          public ActionContext bind()

      Deprecated.
      Description copied from class: `ActionContext`
      Binds this context with the current thread
      Overrides:
        `bind` in class `ActionContext`
      Returns:
        this context which was bound to the thread

    - #### withActionInvocation

          public ActionContext withActionInvocation(ActionInvocation actionInvocation)

      Deprecated.

    - #### withActionInvocation

          public ActionContext withActionInvocation(ActionInvocation actionInvocation)

      Deprecated.
      Description copied from class: `ActionContext`
      Sets the action invocation (the execution state).
      Overrides:
        `withActionInvocation` in class `ActionContext`
      Parameters:
        `actionInvocation` - the action execution state.

    - #### getActionInvocation

          public ActionInvocation getActionInvocation()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets the action invocation (the execution state).
      Overrides:
        `getActionInvocation` in class `ActionContext`
      Returns:
        the action invocation (the execution state).

    - #### withApplication

          public ActionContext withApplication(Map<String,Object> application)

      Deprecated.
      Description copied from class: `ActionContext`
      Sets the action's application context.
      Overrides:
        `withApplication` in class `ActionContext`
      Parameters:
        `application` - the action's application context.

    - #### getApplication

          public Map<String,Object> getApplication()

      Deprecated.
      Description copied from class: `ActionContext`
      Returns a Map of the ServletContext when in a servlet environment or a generic application level Map otherwise.
      Overrides:
        `getApplication` in class `ActionContext`
      Returns:
        a Map of ServletContext or generic application level Map

    - #### getContextMap

          public Map<String,Object> getContextMap()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets the context map.
      Overrides:
        `getContextMap` in class `ActionContext`
      Returns:
        the context map.

    - #### withConversionErrors

          public ActionContext withConversionErrors(Map<String,ConversionData> conversionErrors)

      Deprecated.
      Description copied from class: `ActionContext`
      Sets conversion errors which occurred when executing the action.
      Overrides:
        `withConversionErrors` in class `ActionContext`
      Parameters:
        `conversionErrors` - a Map of errors which occurred when executing the action.

    - #### getConversionErrors

          public Map<String,ConversionData> getConversionErrors()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets the map of conversion errors which occurred when executing the action.
      Overrides:
        `getConversionErrors` in class `ActionContext`
      Returns:
        the map of conversion errors which occurred when executing the action or an empty map if there were no errors.

    - #### withLocale

          public ActionContext withLocale(Locale locale)

      Deprecated.
      Description copied from class: `ActionContext`
      Sets the Locale for the current action.
      Overrides:
        `withLocale` in class `ActionContext`
      Parameters:
        `locale` - the Locale for the current action.

    - #### getLocale

          public Locale getLocale()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets the Locale of the current action. If no locale was ever specified the platform's `default locale` is used.
      Overrides:
        `getLocale` in class `ActionContext`
      Returns:
        the Locale of the current action.

    - #### withActionName

          public ActionContext withActionName(String actionName)

      Deprecated.
      Description copied from class: `ActionContext`
      Sets the name of the current Action in the ActionContext.
      Overrides:
        `withActionName` in class `ActionContext`
      Parameters:
        `actionName` - the name of the current action.

    - #### getActionName

          public String getActionName()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets the name of the current Action.
      Overrides:
        `getActionName` in class `ActionContext`
      Returns:
        the name of the current action.

    - #### withParameters

          public ActionContext withParameters(HttpParameters parameters)

      Deprecated.
      Description copied from class: `ActionContext`
      Sets the action parameters.
      Overrides:
        `withParameters` in class `ActionContext`
      Parameters:
        `parameters` - the parameters for the current action.

    - #### getParameters

          public HttpParameters getParameters()

      Deprecated.
      Description copied from class: `ActionContext`
      Returns a Map of the HttpServletRequest parameters when in a servlet environment or a generic Map of parameters otherwise.
      Overrides:
        `getParameters` in class `ActionContext`
      Returns:
        a Map of HttpServletRequest parameters or a multipart map when in a servlet environment, or a generic Map of parameters otherwise.

    - #### withSession

          public ActionContext withSession(Map<String,Object> session)

      Deprecated.
      Description copied from class: `ActionContext`
      Sets a map of action session values.
      Overrides:
        `withSession` in class `ActionContext`
      Parameters:
        `session` - the session values.

    - #### getSession

          public Map<String,Object> getSession()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets the Map of HttpSession values when in a servlet environment or a generic session map otherwise.
      Overrides:
        `getSession` in class `ActionContext`
      Returns:
        the Map of HttpSession values when in a servlet environment or a generic session map otherwise.

    - #### withValueStack

          public ActionContext withValueStack(ValueStack valueStack)

      Deprecated.

    - #### withValueStack

          public ActionContext withValueStack(ValueStack valueStack)

      Deprecated.
      Description copied from class: `ActionContext`
      Sets the OGNL value stack.
      Overrides:
        `withValueStack` in class `ActionContext`
      Parameters:
        `valueStack` - the OGNL value stack.

    - #### getValueStack

          public ValueStack getValueStack()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets the OGNL value stack.
      Overrides:
        `getValueStack` in class `ActionContext`
      Returns:
        the OGNL value stack.

    - #### withContainer

          public ActionContext withContainer(Container container)

      Deprecated.
      Description copied from class: `ActionContext`
      Gets the container for this request
      Overrides:
        `withContainer` in class `ActionContext`
      Parameters:
        `container` - The container

    - #### getContainer

          public Container getContainer()

      Deprecated.
      Description copied from class: `ActionContext`
      Sets the container for this request
      Overrides:
        `getContainer` in class `ActionContext`
      Returns:
        The container

    - #### getInstance

          public <T> T getInstance(Class<T> type)

      Deprecated.
      Overrides:
        `getInstance` in class `ActionContext`

    - #### get

          public Object get(String key)

      Deprecated.
      Description copied from class: `ActionContext`
      Returns a value that is stored in the current ActionContext by doing a lookup using the value's key.
      Overrides:
        `get` in class `ActionContext`
      Parameters:
        `key` - the key used to find the value.
      Returns:
        the value that was found using the key or `null` if the key was not found.

    - #### put

          public void put(String key,
                          Object value)

      Deprecated.
      Description copied from class: `ActionContext`
      Stores a value in the current ActionContext. The value can be looked up using the key.
      Overrides:
        `put` in class `ActionContext`
      Parameters:
        `key` - the key of the value.
        `value` - the value to be stored.

    - #### getServletContext

          public javax.servlet.ServletContext getServletContext()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets ServletContext associated with current action
      Overrides:
        `getServletContext` in class `ActionContext`
      Returns:
        current ServletContext

    - #### withServletContext

          public ActionContext withServletContext(javax.servlet.ServletContext servletContext)

      Deprecated.
      Description copied from class: `ActionContext`
      Assigns ServletContext to action context
      Overrides:
        `withServletContext` in class `ActionContext`
      Parameters:
        `servletContext` - associated with current request
      Returns:
        ActionContext

    - #### getServletRequest

          public javax.servlet.http.HttpServletRequest getServletRequest()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets ServletRequest associated with current action
      Overrides:
        `getServletRequest` in class `ActionContext`
      Returns:
        current ServletRequest

    - #### withServletRequest

          public ActionContext withServletRequest(javax.servlet.http.HttpServletRequest request)

      Deprecated.
      Description copied from class: `ActionContext`
      Assigns ServletRequest to action context
      Overrides:
        `withServletRequest` in class `ActionContext`
      Parameters:
        `request` - associated with current request
      Returns:
        ActionContext

    - #### getServletResponse

          public javax.servlet.http.HttpServletResponse getServletResponse()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets ServletResponse associated with current action
      Overrides:
        `getServletResponse` in class `ActionContext`
      Returns:
        current ServletResponse

    - #### withServletResponse

          public ActionContext withServletResponse(javax.servlet.http.HttpServletResponse response)

      Deprecated.
      Description copied from class: `ActionContext`
      Assigns ServletResponse to action context
      Overrides:
        `withServletResponse` in class `ActionContext`
      Parameters:
        `response` - associated with current request
      Returns:
        ActionContext

    - #### getPageContext

          public javax.servlet.jsp.PageContext getPageContext()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets PageContext associated with current action
      Overrides:
        `getPageContext` in class `ActionContext`
      Returns:
        current PageContext

    - #### withPageContext

          public ActionContext withPageContext(javax.servlet.jsp.PageContext pageContext)

      Deprecated.
      Description copied from class: `ActionContext`
      Assigns PageContext to action context
      Overrides:
        `withPageContext` in class `ActionContext`
      Parameters:
        `pageContext` - associated with current request
      Returns:
        ActionContext

    - #### getActionMapping

          public ActionMapping getActionMapping()

      Deprecated.
      Description copied from class: `ActionContext`
      Gets ActionMapping associated with current action
      Overrides:
        `getActionMapping` in class `ActionContext`
      Returns:
        current ActionMapping

    - #### withActionMapping

          public ActionContext withActionMapping(ActionMapping actionMapping)

      Deprecated.
      Description copied from class: `ActionContext`
      Assigns ActionMapping to action context
      Overrides:
        `withActionMapping` in class `ActionContext`
      Parameters:
        `actionMapping` - associated with current request
      Returns:
        ActionContext

    - #### withExtraContext

          public ActionContext withExtraContext(Map<String,Object> extraContext)

      Deprecated.
      Description copied from class: `ActionContext`
      Assigns an extra context map to action context
      Overrides:
        `withExtraContext` in class `ActionContext`
      Parameters:
        `extraContext` - to add to the current action context
      Returns:
        ActionContext

    - #### with

          public ActionContext with(String key,
                                    Object value)

      Deprecated.
      Description copied from class: `ActionContext`
      Adds arbitrary key to action context
      Overrides:
        `with` in class `ActionContext`
      Parameters:
        `key` - a string
        `value` - an object
      Returns:
        ActionContext

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