org.apache.shale.application.faces
Class ShaleApplicationFilter

java.lang.Object
  extended by org.apache.shale.application.faces.ShaleApplicationFilter
All Implemented Interfaces:
Filter

public class ShaleApplicationFilter
extends Object
implements Filter

ShaleApplicationFilter is a Filter implementation that invokes the required Application Controller functionality on every request. In addition, it performs overall application startup and shutdown operations on behalf of the framework.

The detailed processing to be performed for each request is configured by a Command or Chain defined using the "Chain of Resposibility" design pattern, as implemented by the Commons Chain package. There must exist a Catalog named shale, which contains a Command named standard, that defines the processing to be performed.

At any point, one of the Commands being executed may choose to complete the response itself (such as to perform an HTTP redirect), instead of allowing processing to continue. To indicate this choice, the Command should follow the standard Commons Chain convention of returning true. If you want processing to continue, return false instead.

The default implementation of the standard command processing chain performs the following tasks:

NOTE - Configuration of the shale catalog, and the commands it contains, may be performed in any manner you desire. One convenient mechanism is to use the ChainListener class that is included in the Commons Chain package. If you do not reconfigure it differently, the standard command (in the shale catalog) will be configured according to the embedded resource org/apache/shale/faces/shale-config.xml in the JAR file containing the core Shale runtime environment, which executes the default request processing described above.

$Id: ShaleApplicationFilter.java 464373 2006-10-16 04:21:54Z rahul $


Field Summary
static String CATALOG_NAME
          The name of the Commons Chain Catalog to use.
static String COMMAND_DESTROY
          The name of the Command to execute during application shutdown.
static String COMMAND_INIT
          The name of the Command to execute during application startup.
static String COMMAND_POSTPROCESS
          The name of the Command to execute after the application logic itself is invoked.
static String COMMAND_PREPROCESS
          The name of the Command to execute before the application logic itself is invoked.
static String CONTEXT_ATTR
          The request scope attribute key under which the Context object used for this chain of command request to be stored, in addition to it being passed in to the command chains.
static String RESOURCE_NAME
          The name of the internal resource containing our default configuration of the default command.
 
Constructor Summary
ShaleApplicationFilter()
           
 
Method Summary
 void destroy()
          Perform application shutdown finalization as necessary.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
          Perform per-request application controler functionality.
 void init(FilterConfig config)
          Perform application startup intiialization as necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATALOG_NAME

public static final String CATALOG_NAME

The name of the Commons Chain Catalog to use.

See Also:
Constant Field Values

COMMAND_DESTROY

public static final String COMMAND_DESTROY

The name of the Command to execute during application shutdown.

See Also:
Constant Field Values

COMMAND_INIT

public static final String COMMAND_INIT

The name of the Command to execute during application startup.

See Also:
Constant Field Values

COMMAND_PREPROCESS

public static final String COMMAND_PREPROCESS

The name of the Command to execute before the application logic itself is invoked.

See Also:
Constant Field Values

COMMAND_POSTPROCESS

public static final String COMMAND_POSTPROCESS

The name of the Command to execute after the application logic itself is invoked.

See Also:
Constant Field Values

CONTEXT_ATTR

public static final String CONTEXT_ATTR

The request scope attribute key under which the Context object used for this chain of command request to be stored, in addition to it being passed in to the command chains.

See Also:
Constant Field Values

RESOURCE_NAME

public static final String RESOURCE_NAME

The name of the internal resource containing our default configuration of the default command.

See Also:
Constant Field Values
Constructor Detail

ShaleApplicationFilter

public ShaleApplicationFilter()
Method Detail

destroy

public void destroy()

Perform application shutdown finalization as necessary.

Specified by:
destroy in interface Filter

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws IOException,
                     ServletException

Perform per-request application controler functionality.

Specified by:
doFilter in interface Filter
Parameters:
request - The request we are processing
response - The response we are creating
chain - The filter chain for this request
Throws:
IOException - if an input/output error occurs
ServletException - if a servlet exception is thrown

init

public void init(FilterConfig config)
          throws ServletException

Perform application startup intiialization as necessary.

Specified by:
init in interface Filter
Parameters:
config - FilterConfig for this filter
Throws:
ServletException - if a servlet exception is thrown


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