com.sun.ws.rest.api.client
Class ClientFilter

java.lang.Object
  extended by com.sun.ws.rest.api.client.ClientFilter
All Implemented Interfaces:
ClientHandler

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.ws.rest.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(mcr);
 
             // Modify the response
             return modifyResponse(resp);
         }

         private byte[] loadClassData(String name) {
             // load the class data from the connection
              . . .
         }
     }
 


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.