caucho
Resin
FAQ
Reference Guide
JavaDoc
Demo
Tutorial

Getting Started
Configuration
EJB
IDE
Topics
JSP
XTP/XSL

Basic Config
Resin Config
HTTP Config
App Config
Servlet Config
Filter Config
SSL
Login Config
DB Config
Taglib Config
Summary
 Filter Configuration

Servlet Config
Configuration
SSL

Filter configuration follows the Servlet 2.3 deployment descriptors. Filters generally belong in the WEB-INF/classes directory of the web application.

The mapping from url to filter is controlled by filter mapping in the application configuration.

web-app
filter Defines a filter alias for later mapping.

web-app/filter
filter-name Alias of the filter
filter-class Class of the filter
init-param Initializes filter variables.

web-app/filter-mapping
filter-mapping Maps url patterns to filters.

web-app

filter

Servlet 2.3

Defines a filter alias for later mapping.

filter-name The filter's name (alias)
filter-class The filter's class (defaults to servlet-name)
init-param Initialization parameters

The following example defines a filter alias 'image'

<web-app id='/'>

<filter-mapping url-pattern='/images/*'
                 filter-name='image'/>

<filter filter-name='image'
         filter-class='test.MyImage'>
  <init-param title='Hello, World'/>
</servlet>

</web-app>

web-app/filter

filter-name

Servlet 2.3

Alias of the filter

filter-class

Servlet 2.3

Class of the filter The CLASSPATH for filters includes the WEB-INF/classes directory and all jars in the WEB-INF/lib directory.

init-param

Servlet 2.3

Initializes filter variables. filter-param defines initial values for getFilterConfig().getInitParameter("foo"). The full Servlet 2.3 syntax for init-param is supported and allows a simple shortcut

<web-app id='/'>

<filter filter-name='test.HelloWorld'>
  <init-param foo='bar'/>

  <init-param>
    <param-name>baz</param-name>
    <param-value>value</param-value>
  </init-param>
</servlet>

</web-app>

web-app/filter-mapping

filter-mapping

Servlet 2.3

Maps url patterns to filters. filter-mapping has two children, url-pattern and filter-name. url-pattern selects the urls which should execute the filter.

filter-name can either specify a servlet class directly or it can specify a servlet alias defined by filter.

url-pattern A pattern matching the url: /foo/*, /foo, or *.foo
url-regexp A regular expression matching the url
servlet-name A servlet name to match.
filter-name The filter name
filter-class The filter class
init-param Initialization parameters

<caucho.com>
<web-app id='/'>

<servlet servlet-name='hello'
         servlet-class='test.HelloWorld'/>

<servlet-mapping url-pattern='/hello'
                 servlet-name='hello'/>

<filter filter-name='test-filter'
        filter-class='test.MyFilter'/>

<filter-mapping url-pattern='/hello/*'
                 filter-name='test-filter'/>

<filter-mapping servlet-name='hello'
                 filter-name='test.SecondFilter'/>

</web-app>

Servlet Config
Configuration
SSL
Copyright © 1998-2001 Caucho Technology. All rights reserved.
Copyright © 1998-2001 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.