org.restlet.client.engine.http
Class ClientCall

java.lang.Object
  extended by org.restlet.client.engine.http.Call
      extended by org.restlet.client.engine.http.ClientCall
Direct Known Subclasses:
GwtClientCall

public abstract class ClientCall
extends Call

Low-level HTTP client call.

Author:
Jerome Louvel

Constructor Summary
ClientCall(HttpClientHelper helper, String method, String requestUri)
          Constructor setting the request address to the local host.
 
Method Summary
protected  long getContentLength()
          Returns the content length of the request entity if know, Representation.UNKNOWN_SIZE otherwise.
 HttpClientHelper getHelper()
          Returns the HTTP client helper.
static String getLocalAddress()
          Returns the local IP address or 127.0.0.1 if the resolution fails.
abstract  String getRequestEntityString()
          Returns the request entity string if it exists.
 Representation getResponseEntity(Response response)
          Returns the response entity if available.
abstract  InputStream getResponseEntityStream(long size)
          Returns the response entity stream if it exists.
protected  boolean isClientKeepAlive()
          Indicates if the client wants a persistent connection.
protected  boolean isServerKeepAlive()
          Indicates if the server wants a persistent connection.
static String parseContentDisposition(String value)
          Deprecated. Use DispositionReader instead.
 void sendRequest(Request request, Response response, Uniform callback)
          Sends the request to the client.
protected  boolean shouldRequestBeChunked(Request request)
          Indicates if the request entity should be chunked.
 
Methods inherited from class org.restlet.client.engine.http.Call
getClientAddress, getClientPort, getHostDomain, getHostPort, getLogger, getMethod, getProtocol, getReasonPhrase, getRepresentation, getRequestHeaders, getRequestUri, getResponseHeaders, getServerAddress, getServerPort, getStatusCode, getVersion, isBroken, isConfidential, isKeepAlive, isRequestChunked, isResponseChunked, setClientAddress, setClientPort, setConfidential, setHostDomain, setHostPort, setMethod, setProtocol, setReasonPhrase, setRequestUri, setServerAddress, setServerPort, setStatusCode, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientCall

public ClientCall(HttpClientHelper helper,
                  String method,
                  String requestUri)
Constructor setting the request address to the local host.

Parameters:
helper - The parent HTTP client helper.
method - The method name.
requestUri - The request URI.
Method Detail

getLocalAddress

public static String getLocalAddress()
Returns the local IP address or 127.0.0.1 if the resolution fails.

Returns:
The local IP address or 127.0.0.1 if the resolution fails.

parseContentDisposition

@Deprecated
public static String parseContentDisposition(String value)
Deprecated. Use DispositionReader instead.

Parse the Content-Disposition header value

Parameters:
value - Content-disposition header
Returns:
Filename

getContentLength

protected long getContentLength()
Returns the content length of the request entity if know, Representation.UNKNOWN_SIZE otherwise.

Returns:
The request content length.

getHelper

public HttpClientHelper getHelper()
Returns the HTTP client helper.

Returns:
The HTTP client helper.

getRequestEntityString

public abstract String getRequestEntityString()
Returns the request entity string if it exists.

Returns:
The request entity string if it exists.

getResponseEntity

public Representation getResponseEntity(Response response)
Returns the response entity if available. Note that no metadata is associated by default, you have to manually set them from your headers.

Parameters:
response - the Response to get the entity from
Returns:
The response entity if available.

getResponseEntityStream

public abstract InputStream getResponseEntityStream(long size)
Returns the response entity stream if it exists.

Parameters:
size - The expected entity size or -1 if unknown.
Returns:
The response entity stream if it exists.

isClientKeepAlive

protected boolean isClientKeepAlive()
Description copied from class: Call
Indicates if the client wants a persistent connection.

Specified by:
isClientKeepAlive in class Call
Returns:
True if the client wants a persistent connection.

isServerKeepAlive

protected boolean isServerKeepAlive()
Description copied from class: Call
Indicates if the server wants a persistent connection.

Specified by:
isServerKeepAlive in class Call
Returns:
True if the server wants a persistent connection.

sendRequest

public void sendRequest(Request request,
                        Response response,
                        Uniform callback)
                 throws Exception
Sends the request to the client. Commits the request line, headers and optional entity and send them over the network.

Parameters:
request - The high-level request.
response - The high-level response.
callback - The callback invoked upon request completion.
Throws:
Exception

shouldRequestBeChunked

protected boolean shouldRequestBeChunked(Request request)
Indicates if the request entity should be chunked.

Returns:
True if the request should be chunked


Copyright © 2005-2013 Restlet S.A.S..