org.apache.shale.clay.faces
Class ClayViewHandlerCommand

java.lang.Object
  extended by org.apache.shale.clay.faces.ClayViewHandlerCommand
All Implemented Interfaces:
Command

public class ClayViewHandlerCommand
extends Object
implements Command

This is a Shale "preprocess" command that should be registered with the shale chains catalog. It is only need for implementing full Clay html or XML views with myfaces. The myfaces implementation pays strict attention to the javax.faces.DEFAULT_SUFFIX setting, only allowing viewId's with this suffix. This command will place an indicator in request scope before the request is processed by the faces servlet. The ClayViewHandler will use the indicator to determine that the view should be handled by the ClayViewHandler.


Field Summary
 
Fields inherited from interface org.apache.commons.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
 
Constructor Summary
ClayViewHandlerCommand()
           
 
Method Summary
 boolean execute(Context context)
          Looks at the request uri to determine if the target page is a clay template.
protected  int indexOfClayTemplateSuffix(Context context)
          Checks the request.uri to determine if it's suffix matches one of the suffixes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClayViewHandlerCommand

public ClayViewHandlerCommand()
Method Detail

execute

public boolean execute(Context context)
                throws Exception

Looks at the request uri to determine if the target page is a clay template. If the request's pathInfo matches the clay template suffixes, a flag is added to the request attributes. This is need for the MyFaces JSF implementation.

Specified by:
execute in interface Command
Parameters:
context - commons chains
Returns:
true if the chains is final
Throws:
Exception - throws back up the calling stack

indexOfClayTemplateSuffix

protected int indexOfClayTemplateSuffix(Context context)

Checks the request.uri to determine if it's suffix matches one of the suffixes. If a match is found, the index into the suffixes array is returned. A value of -1 is returned if a match is not found.

Parameters:
context - commons chains
Returns:
index into suffixes


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.