org.jboss.weld.jsf
Class ConversationAwareViewHandler

java.lang.Object
  extended by javax.faces.application.ViewHandler
      extended by javax.faces.application.ViewHandlerWrapper
          extended by org.jboss.weld.jsf.ConversationAwareViewHandler
All Implemented Interfaces:
javax.faces.FacesWrapper<javax.faces.application.ViewHandler>

public class ConversationAwareViewHandler
extends javax.faces.application.ViewHandlerWrapper

A forwarding JSF ViewHandler implementation that produces URLs containing the conversation id query string parameter. All methods except those which produce a URL that need to be enhanced are forwarded to the ViewHandler delegate.

A request parameter was choosen to propagate the conversation because it's the most technology agnostic approach for passing data between requests and allows for the ensuing request to use whatever means necessary (a servlet filter, phase listener, etc) to capture the conversation id and restore the long-running conversation.

Author:
Dan Allen, Pete Muir, Ales Justin

Field Summary
 
Fields inherited from class javax.faces.application.ViewHandler
CHARACTER_ENCODING_KEY, DEFAULT_FACELETS_SUFFIX, DEFAULT_SUFFIX, DEFAULT_SUFFIX_PARAM_NAME, FACELETS_SUFFIX_PARAM_NAME, FACELETS_VIEW_MAPPINGS_PARAM_NAME
 
Constructor Summary
ConversationAwareViewHandler(javax.faces.application.ViewHandler delegate)
           
 
Method Summary
 String getActionURL(javax.faces.context.FacesContext facesContext, String viewId)
          Allow the delegate to produce the action URL.
 String getBookmarkableURL(javax.faces.context.FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
           
 String getRedirectURL(javax.faces.context.FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
           
 String getResourceURL(javax.faces.context.FacesContext context, String path)
           
 javax.faces.application.ViewHandler getWrapped()
           
 
Methods inherited from class javax.faces.application.ViewHandlerWrapper
calculateCharacterEncoding, calculateLocale, calculateRenderKitId, createView, deriveViewId, getViewDeclarationLanguage, initView, renderView, restoreView, writeState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversationAwareViewHandler

public ConversationAwareViewHandler(javax.faces.application.ViewHandler delegate)
Method Detail

getActionURL

public String getActionURL(javax.faces.context.FacesContext facesContext,
                           String viewId)
Allow the delegate to produce the action URL. If the conversation is long-running, append the conversation id request parameter to the query string part of the URL, but only if the request parameter is not already present.

This covers form actions Ajax calls, and redirect URLs (which we want) and link hrefs (which we don't)

Overrides:
getActionURL in class javax.faces.application.ViewHandlerWrapper
See Also:
ViewHandler#getActionURL(FacesContext, String)}

getBookmarkableURL

public String getBookmarkableURL(javax.faces.context.FacesContext context,
                                 String viewId,
                                 Map<String,List<String>> parameters,
                                 boolean includeViewParams)
Overrides:
getBookmarkableURL in class javax.faces.application.ViewHandlerWrapper

getRedirectURL

public String getRedirectURL(javax.faces.context.FacesContext context,
                             String viewId,
                             Map<String,List<String>> parameters,
                             boolean includeViewParams)
Overrides:
getRedirectURL in class javax.faces.application.ViewHandlerWrapper

getResourceURL

public String getResourceURL(javax.faces.context.FacesContext context,
                             String path)
Overrides:
getResourceURL in class javax.faces.application.ViewHandlerWrapper

getWrapped

public javax.faces.application.ViewHandler getWrapped()
Specified by:
getWrapped in interface javax.faces.FacesWrapper<javax.faces.application.ViewHandler>
Overrides:
getWrapped in class javax.faces.application.ViewHandlerWrapper


Copyright © 2013 Seam Framework. All Rights Reserved.