: Class FilterHandler

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mortbay.HTTP.Handler
Class FilterHandler

    java.lang.Object
      |
      +--com.mortbay.HTTP.Handler.NullHandler
            |
            +--com.mortbay.HTTP.Handler.FilterHandler

public class FilterHandler
extends NullHandler

Filter HttpHandler

Filter handler can be used to insert filters into the outputStream of the response generated by subsequent handlers. It is intended to be allow modifications of responses such as:

- Wrapping another reply in a look and feel.
- Expanding tags from a file or forward generated response to add more dynamic content (See HtmlFilter).
- Modify link paths
- etc.
  It is configured with a PathMap of paths to HttpFilter class names or Properties instance containing a similar mapping.

  If the path matches a request, new filter instances are added to the response. These will only be activated if their content types match that of the response (which may be set later). If the filter class has a constructor that take a HttpRequest then the request is passed, otherwise the default constructor is used.

  Version:
    $Id: FilterHandler.java,v 2.5 1999/09/22 15:08:42 gregw Exp $
  Author:
    Greg Wilkins

  Fields inherited from class com.mortbay.HTTP.Handler.NullHandler
  `httpServer`

  Constructor Summary
  `FilterHandler(PathMap filterMap)` Construct a FilterHandler
  `FilterHandler(java.util.Properties properties)` Construct basic auth handler.

  Method Summary
  `void` | `handle(HttpRequest request, HttpResponse response)` Handle filters for requests.
  `void` | `setProperties(java.util.Properties properties)` Configure from Properties.

  Methods inherited from class com.mortbay.HTTP.Handler.NullHandler
  `destroy, getProperties, servlet, servletNames, setServer, translate`

  Methods inherited from class java.lang.Object
  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  Constructor Detail

  ### FilterHandler

      public FilterHandler(java.util.Properties properties)
                    throws java.io.IOException

    Construct basic auth handler.
    Parameters:
      `properties` - Passed to setProperties

  ### FilterHandler

      public FilterHandler(PathMap filterMap)

    Construct a FilterHandler
    Parameters:
      `filterMap` - A PathMap mapping paths to be filtered to either the class name of a HttpFilter or a Vector of class names. If the a request path maps to 1 or more filters, these are added to the HttpResponse in order.

  Method Detail

  ### setProperties

      public void setProperties(java.util.Properties properties)
                         throws java.io.IOException

    Configure from Properties. Properties are assumed to be in the format of a PropertyTree like:

         name.CLASS : filterClassName
         name.PATHS : /list/of/paths

    Overrides:
      setProperties in class NullHandler
    Parameters:
      `properties` - Configuration.

  ### handle

      public void handle(HttpRequest request,
                         HttpResponse response)
                  throws java.lang.Exception

    Handle filters for requests. Add a HttpFilter instance to the response for each matching filter
    Overrides:
      handle in class NullHandler
    Tags copied from interface: HttpHandler
    Parameters:
      `request` - The HTTP requests to be handled
      `response` - The HTTP response to be used.

  Overview | Package | Class | Tree | Deprecated | Index | Help
  PREV CLASS NEXT CLASS | FRAMES NO FRAMES
  SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD