: Class HttpFilter

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
Class HttpFilter

    java.lang.Object
      |
      +--java.io.OutputStream
            |
            +--java.io.FilterOutputStream
                  |
                  +--com.mortbay.HTTP.HttpFilter

Direct Known Subclasses:
  GzipFilter, HtmlFilter

public class HttpFilter
extends java.io.FilterOutputStream
implements java.util.Observer

Http Filter Derived Http Filters may be added into HttpOutputStreams. A HttpOutputStream will check the content types handled by a filter and if pass all output through the filter if it can handle the type of the HTTP response. The FilterHandler HttpHandler can be used to insert HttpFilters into HttpResponses.

ActivateOn is called after any HTTP/1.1 chunked output is added to the HttpOutputStream, so filters always receive pre-chunked data.

Version:
  $Id: HttpFilter.java,v 2.6 2000/06/02 23:41:05 gregw Exp $
Author:
  Greg Wilkins

Field Summary
`protected HttpRequest` | `request`
`protected HttpResponse` | `response`

Fields inherited from class java.io.FilterOutputStream
`out`

Constructor Summary
`HttpFilter()`
`HttpFilter(HttpRequest request)`

Method Summary
`protected void` | `activate()` Notify derived class of activation
`void` | `activateOn(HttpResponse response)` Activate a filter on a response.
`protected boolean` | `canHandle(java.lang.String contentType)` Check for handling of content type.
`void` | `test(java.io.OutputStream out)` Set output stream for testing purposes.
`void` | `update(java.util.Observable o, java.lang.Object arg)` Observer update.

Methods inherited from class java.io.FilterOutputStream
`close, flush, write, write, write`

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

Field Detail

### request

    protected HttpRequest request

### response

    protected HttpResponse response

Constructor Detail

### HttpFilter

    public HttpFilter()

### HttpFilter

    public HttpFilter(HttpRequest request)

Method Detail

### canHandle

    protected boolean canHandle(java.lang.String contentType)

  Check for handling of content type. This method must be implemented by the derived class to indicate the content types handled by the filter. The default implementation returns true for text content types. Called by activate.

### activateOn

    public final void activateOn(HttpResponse response)
                          throws java.io.IOException

  Activate a filter on a response. Activate is called on a filter by a HttpResponse, normally just before the response headers are written. If canHandle() returns true, the filter is inserted into the HttpResponse output stream and a thread started to run the filter.

### test

    public void test(java.io.OutputStream out)

  Set output stream for testing purposes.
  Parameters:
    `out` - OutputStream

### activate

    protected void activate()

  Notify derived class of activation

### update

    public void update(java.util.Observable o,
                       java.lang.Object arg)

  Observer update. This method is called as part of the Observer pattern to notify the filter that headers are about to be written. The call is delegated to activateOn(HttpResponse).
  Specified by:
    update in interface java.util.Observer
  Parameters:
    `o` - ignored
    `arg` - The HttpResponse.

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