Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.webflow.context
Interface ExternalContext

All Known Implementing Classes:
  MockExternalContext, MvcExternalContext, PortletExternalContext, ServletExternalContext

    public interface ExternalContext

A facade that provides normalized access to an external system that has called into the Spring Web Flow system.

This context object provides a normalized interface for internal web flow artifacts to use to reason on and manipulate the state of an external actor calling into SWF to execute flows. It represents the context about a single, external client request to manipulate a flow execution.

The design of this interface was inspired by JSF's own ExternalContext abstraction and shares the same name for consistency. If a particular external client type does not support all methods defined by this interface, they can just be implemented as returning an empty map or `null`.

Author:
  Keith Donald, Erwin Vervaet, Jeremy Grelle, Scott Andrews

Method Summary
`SharedAttributeMap` | `getApplicationMap()` Provides access to the external application map, providing a storage for data local to the current user application and accessible to both internal and external SWF artifacts.
`java.lang.String` | `getContextPath()` Returns the logical path to the application hosting this external context.
`java.security.Principal` | `getCurrentUser()` Provides access to the user's principal security object.
`java.lang.String` | `getFlowExecutionUrl(java.lang.String flowId, java.lang.String flowExecutionKey)` Get a flow execution URL for the execution with the provided key.
`SharedAttributeMap` | `getGlobalSessionMap()` Provides access to the global external session map, providing a storage for data globally accross the user session and accessible to both internal and external SWF artifacts.
`java.util.Locale` | `getLocale()` Returns the client locale.
`java.lang.Object` | `getNativeContext()` Provides access to the context object for the current environment.
`java.lang.Object` | `getNativeRequest()` Provides access to the request object for the current environment.
`java.lang.Object` | `getNativeResponse()` Provides access to the response object for the current environment.
`MutableAttributeMap` | `getRequestMap()` Provides access to the external request attribute map, providing a storage for data local to the current user request and accessible to both internal and external SWF artifacts.
`ParameterMap` | `getRequestParameterMap()` Provides access to the parameters associated with the user request that led to SWF being called.
`java.io.Writer` | `getResponseWriter()` Get a writer for writing out a response.
`SharedAttributeMap` | `getSessionMap()` Provides access to the external session map, providing a storage for data local to the current user session and accessible to both internal and external SWF artifacts.
`boolean` | `isAjaxRequest()` Returns true if the current request is an asynchronous Ajax request.
`boolean` | `isResponseAllowed()` Is a render response allowed to be written for this request? Always return false after a response has been completed.
`boolean` | `isResponseComplete()` Has the response been completed? Response complete status can be achieved by: Writing out the response and calling `recordResponseComplete()`, or Calling one of the redirect request methods
`boolean` | `isResponseCompleteFlowExecutionRedirect()` Returns true if the response has been completed with flow execution redirect request.
`void` | `recordResponseComplete()` Called by flow artifacts such as View states and end states to indicate they handled the response, typically by writing out content to the response stream.
`void` | `requestExternalRedirect(java.lang.String location)` Request a redirect to an arbitrary resource location.
`void` | `requestFlowDefinitionRedirect(java.lang.String flowId, MutableAttributeMap input)` Request that a flow definition redirect be performed by the calling environment.
`void` | `requestFlowExecutionRedirect()` Request that a flow execution redirect be performed by the calling environment.
`void` | `requestRedirectInPopup()` Request that the current redirect requested be sent to the client in a manner that causes the client to issue the redirect from a popup dialog.

Method Detail

### getContextPath

    java.lang.String getContextPath()

  Returns the logical path to the application hosting this external context.

  Returns:
    the context path

### getRequestParameterMap

    ParameterMap getRequestParameterMap()

  Provides access to the parameters associated with the user request that led to SWF being called. This map is expected to be immutable and cannot be changed.

  Returns:
    the immutable request parameter map

### getRequestMap

    MutableAttributeMap getRequestMap()

  Provides access to the external request attribute map, providing a storage for data local to the current user request and accessible to both internal and external SWF artifacts.

  Returns:
    the mutable request attribute map

### getSessionMap

    SharedAttributeMap getSessionMap()

  Provides access to the external session map, providing a storage for data local to the current user session and accessible to both internal and external SWF artifacts.

  Returns:
    the mutable session attribute map

### getGlobalSessionMap

    SharedAttributeMap getGlobalSessionMap()

  Provides access to the global external session map, providing a storage for data globally accross the user session and accessible to both internal and external SWF artifacts.

  Note: most external context implementations do not distinguish between the concept of a "local" user session scope and a "global" session scope. The Portlet world does, but not the Servlet for example. In those cases calling this method returns the same map as calling `getSessionMap()`.

  Returns:
    the mutable global session attribute map

### getApplicationMap

    SharedAttributeMap getApplicationMap()

  Provides access to the external application map, providing a storage for data local to the current user application and accessible to both internal and external SWF artifacts.

  Returns:
    the mutable application attribute map

### isAjaxRequest

    boolean isAjaxRequest()

  Returns true if the current request is an asynchronous Ajax request.

  Returns:
    true if the current request is an Ajax request

### getFlowExecutionUrl

    java.lang.String getFlowExecutionUrl(java.lang.String flowId,
                                         java.lang.String flowExecutionKey)

  Get a flow execution URL for the execution with the provided key. Typically used by response writers that write out references to the flow execution to support postback on a subsequent request. The URL returned is encoded.

  Parameters:
    `flowId` - the flow definition id
    `flowExecutionKey` - the flow execution key
  Returns:
    the flow execution URL

### getCurrentUser

    java.security.Principal getCurrentUser()

  Provides access to the user's principal security object.

  Returns:
    the user principal

### getLocale

    java.util.Locale getLocale()

  Returns the client locale.

  Returns:
    the locale

### getNativeContext

    java.lang.Object getNativeContext()

  Provides access to the context object for the current environment.

  Returns:
    the environment specific context object

### getNativeRequest

    java.lang.Object getNativeRequest()

  Provides access to the request object for the current environment.

  Returns:
    the environment specific request object.

### getNativeResponse

    java.lang.Object getNativeResponse()

  Provides access to the response object for the current environment.

  Returns:
    the environment specific response object.

### getResponseWriter

    java.io.Writer getResponseWriter()
                                     throws java.lang.IllegalStateException

  Get a writer for writing out a response.

  Returns:
    the writer
  Throws:
    `java.lang.IllegalStateException` - if the response has completed or is not allowed

### isResponseAllowed

    boolean isResponseAllowed()

  Is a render response allowed to be written for this request? Always return false after a response has been completed. May return false before that to indicate a response is not allowed to be completed. For example, in a Portlet environment, render responses are only allowed in render requests.

  Returns:
    true if yes, false otherwise

### requestFlowExecutionRedirect

    void requestFlowExecutionRedirect()
                                      throws java.lang.IllegalStateException

  Request that a flow execution redirect be performed by the calling environment. Typically called from within a flow execution to request a refresh operation, usually to support "refresh after event processing" behavior. Calling this method also sets responseComplete status to true.

  Throws:
    `java.lang.IllegalStateException` - if the response has completed
  See Also:
    `isResponseComplete()`

### requestFlowDefinitionRedirect

    void requestFlowDefinitionRedirect(java.lang.String flowId,
                                       MutableAttributeMap input)
                                       throws java.lang.IllegalStateException

  Request that a flow definition redirect be performed by the calling environment. Typically called from within a flow execution end state to request starting a new, independent execution of a flow in a chain-like manner. Calling this method also sets responseComplete status to true.

  Parameters:
    `flowId` - the id of the flow definition to redirect to
    `input` - input to pass the flow; this input is generally encoded the url to launch the flow
  Throws:
    `java.lang.IllegalStateException` - if the response has completed
  See Also:
    `isResponseComplete()`

### requestExternalRedirect

    void requestExternalRedirect(java.lang.String location)
                                 throws java.lang.IllegalStateException

  Request a redirect to an arbitrary resource location. May not be supported in some environments. Calling this method also sets responseComplete status to true.

  Parameters:
    `location` - the location of the resource to redirect to
  Throws:
    `java.lang.IllegalStateException` - if the response has completed
  See Also:
    `isResponseComplete()`

### requestRedirectInPopup

    void requestRedirectInPopup()
                                throws java.lang.IllegalStateException

  Request that the current redirect requested be sent to the client in a manner that causes the client to issue the redirect from a popup dialog. Only call this method after a redirect has been requested.

  Throws:
    `java.lang.IllegalStateException` - if a redirect has not been requested
  See Also:
    `requestFlowExecutionRedirect()`, `requestFlowDefinitionRedirect(String, MutableAttributeMap)`, `requestExternalRedirect(String)`

### recordResponseComplete

    void recordResponseComplete()

  Called by flow artifacts such as View states and end states to indicate they handled the response, typically by writing out content to the response stream. Setting this flag allows this external context to know the response was handled, and that it not need to take additional response handling action itself.

### isResponseComplete

    boolean isResponseComplete()

  Has the response been completed? Response complete status can be achieved by:
  - Writing out the response and calling `recordResponseComplete()`, or
  - Calling one of the redirect request methods

  Returns:
    true if yes, false otherwise
  See Also:
    `getResponseWriter()`, `recordResponseComplete()`, `requestFlowExecutionRedirect()`, `requestFlowDefinitionRedirect(String, MutableAttributeMap)`, `requestExternalRedirect(String)`

### isResponseCompleteFlowExecutionRedirect

    boolean isResponseCompleteFlowExecutionRedirect()

  Returns true if the response has been completed with flow execution redirect request.

  Returns:
    true if a redirect response has been completed
  See Also:
    `isResponseComplete()`, `requestFlowExecutionRedirect()`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD