WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

Package examples.webapp.filterwebapp

This example demonstrates:
  1. how to write a servlet filter
  2. how to register a servlet filter in the web.xml file
  3. how to use filter ordering

See:
          Description

Filter Example File Summary
authenticate.jsp Simple Web Application that uses form authentication to restrict login to certain users.
web.xml Web Application deployment descriptor. The descriptor configures servlets, a welcome file (.html), a login page (.jsp),and an error page (.jsp).
index.html Welcome page for the Filter Web Application
error.jsp Error page for the Filter Web Application
logFilter.java Log filter servlet for the Filter Web Application
loginFilter.java Login filter servlet for the Filter Web Application
loginForm.jsp Login form page for the Filter Web Application
sessionServlet.java Session servlet for the Filter Web Application
 

Package examples.webapp.filterwebapp Description

The Web Application filterWebApp registers two filters for the servlet sessionServlet. The two filters are:

Each request for the sessionServlet invokes the filters in the following order:

  1. loginFilter
  2. logFilter
Note: For each request of the sessionServlet, both the filters will be called in order, which does slow down the response time for the request.

Perform the following steps in order to build and run the example:

  1. Build the example
  2. Run the example

Build the Example

  1. Set up your development shell as described in Setting up your environment.

  2. Compile the example by executing an ant build script or a command.

Run the Example

  1. Start WebLogic Server with the examples configuration.

  2. Load the filterWebApp Web Application into a browser using a URL such as:
      http://hostname:port/filterWebApp
    where:
    hostname
    Host name of the WebLogic Server
    port
    Port where the WebLogic Server is listening for connections


    Documentation is available at
    http://e-docs.bea.com/wls/docs61/

    Copyright © 2001 BEA Systems, Inc. All rights reserved.