|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.ws.rest.api.client.Filterable
com.sun.ws.rest.api.client.Client
public class Client
The HTTP client class for handling requests and responses specified by
ClientHandler
or for creating WebResource
instances.
ClientFilter
instances may be added to the client for filtering
requests and responses (including those of WebResource
instances
created from the client).
A client may be configured by passing a ClientConfig
instance to
the appropriate construtor.
A client may integrate with an IoC framework by passing a
ComponentProvider
instance to the appropriate constructor.
Constructor Summary | |
---|---|
Client(ClientHandler root)
Create a new client instance. |
|
Client(ClientHandler root,
ClientConfig config)
Create a new client instance with a client configuration. |
|
Client(ClientHandler root,
ClientConfig config,
ComponentProvider provider)
Create a new instance with a client configuration and a compoenent provider. |
Method Summary | |
---|---|
void |
addInjectable(java.lang.reflect.Type fieldType,
Injectable injectable)
Add an injectable resource to the set maintained by the client. |
static Client |
create()
Create a default client. |
static Client |
create(ClientConfig cc)
Create a default client with client configuration. |
static Client |
create(ClientConfig cc,
ComponentProvider cp)
Create a default client with client configuration and component provider. |
ClientResponse |
handle(ClientRequest cr)
Handle a HTTP request as a ClientRequest and return the HTTP
response as a ClientResponse . |
WebResource |
resource(java.lang.String u)
Create a Web resource from the client. |
WebResource |
resource(java.net.URI u)
Create a Web resource from the client. |
Methods inherited from class com.sun.ws.rest.api.client.Filterable |
---|
addFilter, getHeadHandler, removeAllFilters, removeFilter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Client(ClientHandler root)
root
- the root client handler for dispatching a request and
returning a response.public Client(ClientHandler root, ClientConfig config)
root
- the root client handler for dispatching a request and
returning a response.config
- the client configuration.public Client(ClientHandler root, ClientConfig config, ComponentProvider provider)
root
- the root client handler for dispatching a request and
returning a response.config
- the client configuration.provider
- the component provider.Method Detail |
---|
public final void addInjectable(java.lang.reflect.Type fieldType, Injectable injectable)
fieldType
- the type of the field that will be injected.injectable
- the injectable for the field.public final WebResource resource(java.lang.String u)
u
- the URI of the resource.
public final WebResource resource(java.net.URI u)
u
- the URI of the resource.
public 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.public static Client create()
public static Client create(ClientConfig cc)
cc
- the client configuration.
public static Client create(ClientConfig cc, ComponentProvider cp)
cc
- the client configuration.cp
- the component provider.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |