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

## com.sun.jersey.api.client.filter
Class ClientFilter

    java.lang.Object
      com.sun.jersey.api.client.filter.ClientFilter

All Implemented Interfaces:
  ClientHandler

Direct Known Subclasses:
  ConnectionListenerFilter, GZIPContentEncodingFilter, HTTPBasicAuthFilter, HTTPDigestAuthFilter, LoggingFilter

    public abstract class ClientFilter

extends java.lang.Object
implements ClientHandler

A client filter capable of modifying the outbound HTTP request or the inbound HTTP response.

An application-based filter extends this class and implements the `ClientHandler.handle(com.sun.jersey.api.client.ClientRequest)` method. The general implementation pattern is as follows:

>          class AppClientFilter extends ClientFilter {

>              public ClientResponse handle(ClientRequest cr) {
>                  // Modify the request
>                  ClientRequest mcr = modifyRequest(cr);

>                  // Call the next client handler in the filter chain
>                  ClientResponse resp = getNext().handle(mcr);

>                  // Modify the response
>                  return modifyResponse(resp);
>              }

>          }

A client filter is re-entrant and may be called by by more than one thread at the same time.

A client filter instance MUST be occur at most once in any `Filterable` instance, otherwise unexpected results may occur. If it is necessary to add the same type of client filter more than once to the same `Filterable` instance or to more than one `Filterable` instance then a new instance of that filter MUST be added.

Author:
  Paul.Sandoz@Sun.Com

Constructor Summary
`ClientFilter()`

Method Summary
`ClientHandler` | `getNext()` Get the next client handler to invoke in the chain of filters.
`abstract ClientResponse` | `handle(ClientRequest cr)` Handle a HTTP request as a `ClientRequest` and return the HTTP response as a `ClientResponse`.

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

Constructor Detail

### ClientFilter

    public ClientFilter()

Method Detail

### getNext

    public final ClientHandler getNext()

  Get the next client handler to invoke in the chain of filters.

  Returns:
    the next client handler.

### handle

    public abstract ClientResponse handle(ClientRequest cr)
                                   throws ClientHandlerException

  Description copied from interface: `ClientHandler`
  Handle a HTTP request as a `ClientRequest` and return the HTTP response as a `ClientResponse`.

  Specified by:
    `handle` in interface `ClientHandler`
  Parameters:
    `cr` - the HTTP request.
  Returns:
    the HTTP response.
  Throws:
    `ClientHandlerException` - if the client handler fails to process the request or response.

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

Copyright © 2011 Oracle Corporation. All Rights Reserved.