org.springframework.webflow.engine.support
Class ApplicationViewSelector

java.lang.Object
  extended by org.springframework.webflow.engine.support.ApplicationViewSelector
All Implemented Interfaces:
java.io.Serializable, ViewSelector

public class ApplicationViewSelector
extends java.lang.Object
implements ViewSelector, java.io.Serializable

Simple view selector that makes an ApplicationView selection using a view name expression.

This factory will treat all attributes returned from calling RequestContext.getModel() as the application model exposed to the view during rendering. This is typically the union of attributes in request, flow, and conversation scope.

This selector also supports setting a redirect flag that can be used to trigger a redirect to the ApplicationView at a bookmarkable URL using an FlowExecutionRedirect}.

Author:
Keith Donald, Erwin Vervaet
See Also:
ApplicationView, FlowExecutionRedirect, Serialized Form

Field Summary
static java.lang.String ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE
          Flow execution attribute name that indicates that we should always render an application view via a redirect.
 
Constructor Summary
ApplicationViewSelector(org.springframework.binding.expression.Expression viewName)
          Creates a application view selector that will make application view selections requesting that the specified view be rendered.
ApplicationViewSelector(org.springframework.binding.expression.Expression viewName, boolean redirect)
          Creates a application view selector that will make application view selections requesting that the specified view be rendered.
 
Method Summary
protected  boolean alwaysRedirectOnPause(RequestContext context)
          Checks the ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE to see if every application view of the flow execution should be rendered via a redirect.
protected  ApplicationView createApplicationView(java.lang.String viewName, RequestContext context)
          Creates the application view selection.
 org.springframework.binding.expression.Expression getViewName()
          Returns the name of the view that should be rendered.
 boolean isEntrySelectionRenderable(RequestContext context)
          Will the primary selection returned by 'makeEntrySelection' for the given request context be renderable in this request?
 boolean isRedirect()
          Returns if a redirect to the view should be done.
 ViewSelection makeEntrySelection(RequestContext context)
          Make a new "entry" view selection for the given request context.
 ViewSelection makeRefreshSelection(RequestContext context)
          Reconstitute a renderable view selection for the given request context to support a ViewState 'refresh' operation.
protected  java.lang.String resolveViewName(RequestContext context)
          Resolves the application view name from the request context.
protected  boolean shouldRedirect(RequestContext context)
          Determine whether or not a redirect should be used to render the application view.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE

public static final java.lang.String ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE
Flow execution attribute name that indicates that we should always render an application view via a redirect.

See Also:
Constant Field Values
Constructor Detail

ApplicationViewSelector

public ApplicationViewSelector(org.springframework.binding.expression.Expression viewName)
Creates a application view selector that will make application view selections requesting that the specified view be rendered.

Parameters:
viewName - the view name expression

ApplicationViewSelector

public ApplicationViewSelector(org.springframework.binding.expression.Expression viewName,
                               boolean redirect)
Creates a application view selector that will make application view selections requesting that the specified view be rendered. No redirects will be done.

Parameters:
viewName - the view name expression
redirect - indicates if a redirect to the view should be initiated
Method Detail

getViewName

public org.springframework.binding.expression.Expression getViewName()
Returns the name of the view that should be rendered.


isRedirect

public boolean isRedirect()
Returns if a redirect to the view should be done.


isEntrySelectionRenderable

public boolean isEntrySelectionRenderable(RequestContext context)
Description copied from interface: ViewSelector
Will the primary selection returned by 'makeEntrySelection' for the given request context be renderable in this request?

"Renderable" view selections typically can have 'render-actions' execute before they are created. An example would be an ApplicationView that forwards to a view template like a JSP. "Non-renderable" view selections are things like a flow execution redirect--no render actually occurs, but only a redirect--rendering happens on the new redirect request.

Specified by:
isEntrySelectionRenderable in interface ViewSelector
Parameters:
context - the current request context of the executing flow
Returns:
true if yes, false otherwise

makeEntrySelection

public ViewSelection makeEntrySelection(RequestContext context)
Description copied from interface: ViewSelector
Make a new "entry" view selection for the given request context. Called when a view-state, end-state, or other interactive state type is entered.

Specified by:
makeEntrySelection in interface ViewSelector
Parameters:
context - the current request context of the executing flow
Returns:
the entry view selection

makeRefreshSelection

public ViewSelection makeRefreshSelection(RequestContext context)
Description copied from interface: ViewSelector
Reconstitute a renderable view selection for the given request context to support a ViewState 'refresh' operation.

Specified by:
makeRefreshSelection in interface ViewSelector
Parameters:
context - the current request context of the executing flow
Returns:
the view selection

resolveViewName

protected java.lang.String resolveViewName(RequestContext context)
Resolves the application view name from the request context.

Parameters:
context - the context
Returns:
the view name

createApplicationView

protected ApplicationView createApplicationView(java.lang.String viewName,
                                                RequestContext context)
Creates the application view selection.

Parameters:
viewName - the resolved view name
context - the context
Returns:
the application view

shouldRedirect

protected boolean shouldRedirect(RequestContext context)
Determine whether or not a redirect should be used to render the application view.

Parameters:
context - the context
Returns:
true or false

alwaysRedirectOnPause

protected boolean alwaysRedirectOnPause(RequestContext context)
Checks the ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE to see if every application view of the flow execution should be rendered via a redirect.

Parameters:
context - the flow execution request context
Returns:
true or false

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004-2007. All Rights Reserved.