org.apache.sesame.filter
Class AbstractFilter

java.lang.Object
  |
  +--org.apache.sesame.filter.AbstractFilter
All Implemented Interfaces:
javax.servlet.Filter
Direct Known Subclasses:
ConnectionFilter

public abstract class AbstractFilter
extends java.lang.Object
implements javax.servlet.Filter

Base Filter class for all Sesame Filters. It provides common helper methods such as easy access to model objects.

Version:
$Id: AbstractFilter.java,v 1.4 2002/06/03 18:18:51 vmassol Exp $
Author:
Vincent Massol

Field Summary
private  javax.servlet.FilterConfig config
          The filter configuration object.
private static java.lang.String HTTP_REQUEST_ATTRIBUTE
          Name under which the @{link Request} object is stored as an HTTP attribute.
 
Constructor Summary
AbstractFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain)
           
abstract  void execute(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain)
          All Sesame filters must implement this method.
 Request getApplicationRequest(javax.servlet.ServletRequest servletRequest)
           
 javax.servlet.FilterConfig getFilterConfig()
           
 void init(javax.servlet.FilterConfig filterConfig)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

HTTP_REQUEST_ATTRIBUTE

private static final java.lang.String HTTP_REQUEST_ATTRIBUTE
Name under which the @{link Request} object is stored as an HTTP attribute.

config

private javax.servlet.FilterConfig config
The filter configuration object.
Constructor Detail

AbstractFilter

public AbstractFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Filter
See Also:
Filter.init(FilterConfig)

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Filter
See Also:
Filter.destroy()

execute

public abstract void execute(javax.servlet.ServletRequest servletRequest,
                             javax.servlet.ServletResponse servletResponse,
                             javax.servlet.FilterChain filterChain)
                      throws java.io.IOException,
                             javax.servlet.ServletException
All Sesame filters must implement this method. This is where their execution code is placed. This is equivalent to the filter doFilter method but has been renamed so that this AbstractFilter filter can wrap it and perform additionnal actions such as managing exceptions and logging them, etc.
Parameters:
servletRequest - the incoming servlet request
servletResponse - the outgoing servelt response to send back
filterChain - the filter chain
Throws:
java.io.IOException - if an error occurs
javax.servlet.ServletException - if an error occurs

doFilter

public void doFilter(javax.servlet.ServletRequest servletRequest,
                     javax.servlet.ServletResponse servletResponse,
                     javax.servlet.FilterChain filterChain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Specified by:
doFilter in interface javax.servlet.Filter
See Also:
Filter.doFilter(ServletRequest, ServletResponse, FilterChain)

getApplicationRequest

public Request getApplicationRequest(javax.servlet.ServletRequest servletRequest)
                              throws javax.servlet.ServletException
Parameters:
servletRequest - the Servlet request
Returns:
the application Request object
Throws:
javax.servlet.ServletException - if an error occurs

getFilterConfig

public javax.servlet.FilterConfig getFilterConfig()
Returns:
the filter config object


Copyright © 2002-2002 Apache Software Foundation. All Rights Reserved.