org.xlightweb.client
Interface IHttpClientEndpoint

Package class diagram package IHttpClientEndpoint
All Superinterfaces:
Closeable
All Known Implementing Classes:
HttpClient, HttpClientConnection

public interface IHttpClientEndpoint
extends Closeable

Represents the client side endpoint of a http connection


Field Summary
static boolean DEFAULT_AUTOHANDLE_100CONTINUE_RESPONSE
           
 
Method Summary
 IHttpResponse call(IHttpRequest request)
          performs a request.
 String getId()
          returns the id
 long getResponseTimeoutMillis()
          returns the response timeout
 IFutureResponse send(IHttpRequest request)
          send the request.
 BodyDataSink send(IHttpRequestHeader requestHeader, IHttpResponseHandler responseHandler)
          send the request.
 BodyDataSink send(IHttpRequestHeader requestHeader, int contentLength, IHttpResponseHandler responseHandler)
          send the request in a plain body mode

Connection-LifeCycle support: If the request header contains a 'Connection: close' entry, the connection will be closed after the HTTP transaction
 void send(IHttpRequest request, IHttpResponseHandler responseHandler)
          send the request.
 void setResponseTimeoutMillis(long responseTimeout)
          set the response time out by performing the call or send method.
 
Methods inherited from interface java.io.Closeable
close
 

Field Detail

DEFAULT_AUTOHANDLE_100CONTINUE_RESPONSE

static final boolean DEFAULT_AUTOHANDLE_100CONTINUE_RESPONSE
See Also:
Constant Field Values
Method Detail

setResponseTimeoutMillis

void setResponseTimeoutMillis(long responseTimeout)
set the response time out by performing the call or send method.

Parameters:
responseTimeout - the response timeout

getResponseTimeoutMillis

long getResponseTimeoutMillis()
returns the response timeout

Returns:
the response timeout

call

IHttpResponse call(IHttpRequest request)
                   throws IOException,
                          ConnectException,
                          SocketTimeoutException
performs a request. This method blocks until the response (header) is received.

Parameters:
request - the request
Returns:
the response
Throws:
IOException - if an exception occurs
ConnectException - if an error occurred while attempting to connect to a remote address and port.
SocketTimeoutException - if the received timeout is exceed

send

BodyDataSink send(IHttpRequestHeader requestHeader,
                  IHttpResponseHandler responseHandler)
                  throws IOException,
                         ConnectException
send the request. If the content-length header is not set, the message will send in chunked mode

Parameters:
requestHeader - the request header
responseHandler - the response handler or null (supported: IHttpRequestHandler, IHttpSocketTimeoutHandler)
Returns:
the body handle to write
Throws:
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs

send

BodyDataSink send(IHttpRequestHeader requestHeader,
                  int contentLength,
                  IHttpResponseHandler responseHandler)
                  throws IOException,
                         ConnectException
send the request in a plain body mode

Parameters:
requestHeader - the request header
contentLength - the content length
responseHandler - the response handler or null (supported: IHttpRequestHandler, IHttpSocketTimeoutHandler)
Returns:
the body handle to write
Throws:
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs

send

void send(IHttpRequest request,
          IHttpResponseHandler responseHandler)
          throws IOException,
                 ConnectException
send the request.

Parameters:
request - the request
responseHandler - the response handler or null (supported: IHttpRequestHandler, IHttpSocketTimeoutHandler)
Throws:
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs

send

IFutureResponse send(IHttpRequest request)
                     throws IOException,
                            ConnectException
send the request.

Parameters:
request - the request
response - the response
Throws:
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs

getId

String getId()
returns the id

Returns:
id