com.noelios.restlet.http
Class HttpClientConverter

java.lang.Object
  extended by com.noelios.restlet.http.HttpConverter
      extended by com.noelios.restlet.http.HttpClientConverter

public class HttpClientConverter
extends HttpConverter

Converter of high-level uniform calls into low-level HTTP client calls.

Author:
Jerome Louvel

Constructor Summary
HttpClientConverter(Context context)
          Constructor.
 
Method Summary
protected  void addRequestHeaders(HttpClientCall httpCall, Request request)
          Adds the request headers of a uniform call to a HTTP client call.
 void commit(HttpClientCall httpCall, Request request, Response response)
          Commits the changes to a handled HTTP client call back into the original uniform call.
static void copyResponseTransportHeaders(java.lang.Iterable<Parameter> headers, Response response)
          Copies headers into a response.
protected  void readResponseHeaders(HttpClientCall httpCall, Response response)
          Reads the response headers of a handled HTTP client call to update the original uniform call.
 HttpClientCall toSpecific(HttpClientHelper client, Request request)
          Converts a low-level HTTP call into a high-level uniform call.
 
Methods inherited from class com.noelios.restlet.http.HttpConverter
addAdditionalHeaders, getContext, getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientConverter

public HttpClientConverter(Context context)
Constructor.

Parameters:
context - The context to use.
Method Detail

copyResponseTransportHeaders

public static void copyResponseTransportHeaders(java.lang.Iterable<Parameter> headers,
                                                Response response)
Copies headers into a response.

Parameters:
headers - The headers to copy.
response - The response to update.
See Also:
Engine.copyResponseHeaders(Iterable, Response), HttpClientCall.copyResponseEntityHeaders(Iterable, org.restlet.resource.Representation)

addRequestHeaders

protected void addRequestHeaders(HttpClientCall httpCall,
                                 Request request)
Adds the request headers of a uniform call to a HTTP client call.

Parameters:
httpCall - The HTTP client call.
request - The high-level request.

commit

public void commit(HttpClientCall httpCall,
                   Request request,
                   Response response)
Commits the changes to a handled HTTP client call back into the original uniform call. The default implementation first invokes the "addResponseHeaders" then asks the "htppCall" to send the response back to the client.

Parameters:
httpCall - The original HTTP call.
request - The high-level request.
response - The high-level response.

readResponseHeaders

protected void readResponseHeaders(HttpClientCall httpCall,
                                   Response response)
Reads the response headers of a handled HTTP client call to update the original uniform call.

Parameters:
httpCall - The handled HTTP client call.
response - The high-level response to update.

toSpecific

public HttpClientCall toSpecific(HttpClientHelper client,
                                 Request request)
Converts a low-level HTTP call into a high-level uniform call.

Parameters:
client - The HTTP client that will handle the call.
request - The high-level request.
Returns:
A new high-level uniform call.


Copyright © 2005-2008 Noelios Technologies.