|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.jersey.api.client.filter.ClientFilter
public abstract class ClientFilter
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.
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 |
---|
public ClientFilter()
Method Detail |
---|
public final ClientHandler getNext()
public abstract ClientResponse handle(ClientRequest cr) throws ClientHandlerException
ClientHandler
ClientRequest
and return the HTTP
response as a ClientResponse
.
handle
in interface ClientHandler
cr
- the HTTP request.
ClientHandlerException
- if the client
handler fails to process the request or response.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |