Class ActionContext

java.lang.Object
webwork.action.ActionContext

public class ActionContext extends Object
Handles the context of each invoked action while providing an abstraction layer for both servlet and non servlet based applications.

Information is associated with the action's thread so it can be accessed from anywhere by calling a static method.

The context is initially set by the dispatcher.

Version:
$Revision: 1.14 $
Author:
Rickard Öberg (rickard@middleware-company.com), Matt Baldree (matt@smallleap.com), Maurice C. Parker (maurice@vineyardenterprise.com)
See Also:
  • Field Details

  • Constructor Details

    • ActionContext

      public ActionContext()
  • Method Details

    • setContext

      public static void setContext(ActionContext aContext)
    • getContext

      public static ActionContext getContext()
      Returns the ActionContext specific to the current thread.
      Returns:
      ActionContext for the current thread
    • getTable

      public Map getTable()
    • setTable

      public void setTable(Map lookup)
    • put

      public void put(Object key, Object value)
      Stores a value in the current ActionContext. The value can be looked up using the key.
      Parameters:
      key - The key of the value.
      value - The value to be stored.
    • get

      public Object get(Object key)
      Returns a value that is stored in the current ActionContext buy doing a lookup using the value's key.
      Parameters:
      key - The key used to find the value.
      Returns:
      The value that was found using the key.
    • getName

      public static String getName()
      Returns the name of the current Action.
      Returns:
      The current Action name.
    • getNameImpl

      public String getNameImpl()
    • setName

      public static void setName(String name)
      Stores the name of the current Action in the ActionContext.
      Parameters:
      name - The name of the current action.
    • setNameImpl

      public void setNameImpl(String name)
    • getLocale

      public static Locale getLocale()
      Returns the Locale of the current request in a servlet environment or the default Locale in other environments.
      Returns:
      current locale
    • getLocaleImpl

      public Locale getLocaleImpl()
    • setLocale

      public static void setLocale(Locale locale)
      Set the current locale.
      Parameters:
      locale - current locale
    • setLocaleImpl

      public void setLocaleImpl(Locale locale)
    • getSession

      public static Map getSession()
      Returns the HttpSession when in a servlet environment or a generic session map otherwise.
      Returns:
      a map of HttpSession or a generic session map
    • getSessionImpl

      public Map getSessionImpl()
    • setSession

      public static void setSession(Map session)
      Set a session Map.
    • setSessionImpl

      public void setSessionImpl(Map session)
    • getApplication

      public static Map getApplication()
      Returns a Map of the ServletContext when in a servlet environment or a generic application level Map otherwise.
      Returns:
      Map of ServletContext or generic application level Map
    • getApplicationImpl

      public Map getApplicationImpl()
    • setApplication

      public static void setApplication(Map application)
      Set an application level Map.
    • setApplicationImpl

      public void setApplicationImpl(Map application)
    • getParameters

      public static Map getParameters()
      Returns a Map of the HttpServletRequest parameters when in a servlet environment or a generic Map of parameters otherwise.
      Returns:
      Map of HttpServletRequest parameters, generic Map of parameters, or multipart Map.
    • getParametersImpl

      public Map getParametersImpl()
    • setParameters

      public static void setParameters(Map parameters)
      Set a Map of parameters.
      Parameters:
      parameters - The parameters for the current action context.
    • setParametersImpl

      public void setParametersImpl(Map parameters)
    • getSingleValueParameters

      public static Map getSingleValueParameters()
      Get the current ActionContext parameters. Each Map entry is a String.
      Returns:
      The parameters for the current action context.
    • getSingleValueParametersImpl

      public Map getSingleValueParametersImpl()
    • setSingleValueParameters

      public static void setSingleValueParameters(Map parameters)
      Set a Map of single value parameters.
      Parameters:
      parameters - for the current action context.
    • setSingleValueParametersImpl

      public void setSingleValueParametersImpl(Map parameters)
    • getPrincipal

      public static Principal getPrincipal()
      Returns the current user's security Principal.
      Returns:
      the current user's security Principal
    • getPrincipalImpl

      public Principal getPrincipalImpl()
    • setPrincipal

      public static void setPrincipal(Principal principal)
      Set the current user's security Principal.
      Parameters:
      principal - the current user's security Principal
    • setPrincipalImpl

      public void setPrincipalImpl(Principal principal)
    • getMultiPartRequest

      public static MultiPartRequestWrapper getMultiPartRequest()
      Return multipart request for HttpServletRequest.
      Returns:
      MultiPartRequestWrapper
    • getMultiPartRequestImpl

      public MultiPartRequestWrapper getMultiPartRequestImpl()
    • getRequest

      public static javax.servlet.http.HttpServletRequest getRequest()
      Returns the HttpServletRequest object when in a servlet environment.
      Returns:
      HttpServletRequest in a servlet environment or null otherwise
    • getRequestImpl

      public javax.servlet.http.HttpServletRequest getRequestImpl()
    • setRequest

      public static void setRequest(javax.servlet.http.HttpServletRequest request)
      Set the HttpServletRequest.
    • setRequestImpl

      public void setRequestImpl(javax.servlet.http.HttpServletRequest request)
    • getResponse

      public static javax.servlet.http.HttpServletResponse getResponse()
      Returns the HttpServletResponse when in a servlet environment.
      Returns:
      HttpServletResponse or null
    • getResponseImpl

      public javax.servlet.http.HttpServletResponse getResponseImpl()
    • setResponse

      public static void setResponse(javax.servlet.http.HttpServletResponse response)
      Set the HttpServletResponse.
    • setResponseImpl

      public void setResponseImpl(javax.servlet.http.HttpServletResponse response)
    • getServletContext

      public static javax.servlet.ServletContext getServletContext()
      Returns the ServletContext when in a servlet environment.
      Returns:
      ServletContext or null.
    • getServletContextImpl

      public javax.servlet.ServletContext getServletContextImpl()
    • setServletContext

      public static void setServletContext(javax.servlet.ServletContext context)
      Set the ServletContext.
    • setServletContextImpl

      public void setServletContextImpl(javax.servlet.ServletContext context)
    • getValueStack

      public static ValueStack getValueStack()
      Returns the ValueStack specific to the current thread.
      Returns:
      ActionContext for the current thread
    • getValueStackImpl

      public ValueStack getValueStackImpl()
    • setValueStack

      public static void setValueStack(ValueStack valueStack)
      Set the ValueStack.
      Parameters:
      valueStack -
    • setValueStackImpl

      public void setValueStackImpl(ValueStack valueStack)