Package org.glassfish.jersey.client.spi
Interface Connector
-
- All Superinterfaces:
Inflector<ClientRequest,ClientResponse>
- All Known Implementing Classes:
ApacheConnector
,HttpUrlConnector
,JdkConnector
,JettyConnector
public interface Connector extends Inflector<ClientRequest,ClientResponse>
Client transport connector extension contract.Note that unlike most of the other
Jersey SPI extension contracts
, JerseyConnector
is not a typical runtime extension and as such cannot be directly registered using a configurationregister(...)
method. Jersey client runtime retrieves aConnector
instance upon Jersey client runtime initialization using aConnectorProvider
registered inClientConfig
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ClientResponse
apply(ClientRequest request)
Synchronously process client request into a response.java.util.concurrent.Future<?>
apply(ClientRequest request, AsyncConnectorCallback callback)
Asynchronously process client request into a response.void
close()
Close connector and release all it's internally associated resources.java.lang.String
getName()
Get name of current connector.
-
-
-
Method Detail
-
apply
ClientResponse apply(ClientRequest request)
Synchronously process client request into a response. The method is used by Jersey client runtime to synchronously send a request and receive a response.- Specified by:
apply
in interfaceInflector<ClientRequest,ClientResponse>
- Parameters:
request
- Jersey client request to be sent.- Returns:
- Jersey client response received for the client request.
- Throws:
javax.ws.rs.ProcessingException
- in case of any invocation failure.
-
apply
java.util.concurrent.Future<?> apply(ClientRequest request, AsyncConnectorCallback callback)
Asynchronously process client request into a response. The method is used by Jersey client runtime to asynchronously send a request and receive a response.- Parameters:
request
- Jersey client request to be sent.callback
- Jersey asynchronous connector callback to asynchronously receive the request processing result (either a response or a failure).- Returns:
- asynchronously executed task handle.
-
getName
java.lang.String getName()
Get name of current connector. Should contain identification of underlying specification and optionally version number. Will be used in User-Agent header.- Returns:
- name of current connector. Returning
null
or empty string means not including this information in a generated "User-Agent" header.
-
close
void close()
Close connector and release all it's internally associated resources.
-
-