com.noelios.restlet.http
Class StreamClientCall

java.lang.Object
  extended by com.noelios.restlet.http.HttpCall
      extended by com.noelios.restlet.http.HttpClientCall
          extended by com.noelios.restlet.http.StreamClientCall

public class StreamClientCall
extends HttpClientCall

HTTP client call based on streams.

Author:
Jerome Louvel

Constructor Summary
StreamClientCall(StreamClientHelper helper, Request request)
          Constructor.
 
Method Summary
 java.net.Socket createSocket(java.lang.String hostDomain, int hostPort)
          Creates the socket that will be used to send the request and get the response.
 StreamClientHelper getHelper()
          Returns the HTTP client helper.
protected  Representation getRepresentation(java.io.InputStream stream)
          Returns the representation wrapping the given stream.
 java.nio.channels.WritableByteChannel getRequestEntityChannel()
          Returns the request entity channel if it exists.
 java.io.OutputStream getRequestEntityStream()
          Returns the request entity stream if it exists.
 java.io.OutputStream getRequestHeadStream()
          Returns the request head stream if it exists.
 java.nio.channels.ReadableByteChannel getResponseEntityChannel(long size)
          Returns the response channel if it exists.
 java.io.InputStream getResponseEntityStream(long size)
          Returns the response entity stream if it exists.
protected  boolean isClientKeepAlive()
          Indicates if the client wants a persistent connection.
protected  void parseResponse()
          Parses the HTTP response.
 Status sendRequest(Request request)
          Sends the request to the client.
 
Methods inherited from class com.noelios.restlet.http.HttpClientCall
copyResponseEntityHeaders, getContentLength, getLocalAddress, getRepresentation, getResponseEntity, isServerKeepAlive, parseContentDisposition, shouldRequestBeChunked
 
Methods inherited from class com.noelios.restlet.http.HttpCall
formatDate, getClientAddress, getClientPort, getConnectorService, getContentLength, getHostDomain, getHostPort, getLogger, getMethod, getProtocol, getReasonPhrase, getRequestHeaders, getRequestUri, getResponseHeaders, getServerAddress, getServerPort, getStatusCode, getVersion, isConfidential, isConnectionBroken, isKeepAlive, isRequestChunked, isResponseChunked, parseDate, 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

StreamClientCall

public StreamClientCall(StreamClientHelper helper,
                        Request request)
Constructor.

Parameters:
helper - The client connector helper.
request - The request to send.
Method Detail

createSocket

public java.net.Socket createSocket(java.lang.String hostDomain,
                                    int hostPort)
                             throws java.net.UnknownHostException,
                                    java.io.IOException
Creates the socket that will be used to send the request and get the response.

Parameters:
hostDomain - The target host domain name.
hostPort - The target host port.
Returns:
The created socket.
Throws:
java.net.UnknownHostException
java.io.IOException

getHelper

public StreamClientHelper getHelper()
Description copied from class: HttpClientCall
Returns the HTTP client helper.

Overrides:
getHelper in class HttpClientCall
Returns:
The HTTP client helper.

getRepresentation

protected Representation getRepresentation(java.io.InputStream stream)
Description copied from class: HttpClientCall
Returns the representation wrapping the given stream.

Overrides:
getRepresentation in class HttpClientCall
Parameters:
stream - The response input stream.
Returns:
The wrapping representation.

getRequestEntityChannel

public java.nio.channels.WritableByteChannel getRequestEntityChannel()
Description copied from class: HttpClientCall
Returns the request entity channel if it exists.

Specified by:
getRequestEntityChannel in class HttpClientCall
Returns:
The request entity channel if it exists.

getRequestEntityStream

public java.io.OutputStream getRequestEntityStream()
Description copied from class: HttpClientCall
Returns the request entity stream if it exists.

Specified by:
getRequestEntityStream in class HttpClientCall
Returns:
The request entity stream if it exists.

getRequestHeadStream

public java.io.OutputStream getRequestHeadStream()
Description copied from class: HttpClientCall
Returns the request head stream if it exists.

Specified by:
getRequestHeadStream in class HttpClientCall
Returns:
The request head stream if it exists.

getResponseEntityChannel

public java.nio.channels.ReadableByteChannel getResponseEntityChannel(long size)
Description copied from class: HttpClientCall
Returns the response channel if it exists.

Specified by:
getResponseEntityChannel in class HttpClientCall
Parameters:
size - The expected entity size or -1 if unknown.
Returns:
The response channel if it exists.

getResponseEntityStream

public java.io.InputStream getResponseEntityStream(long size)
Description copied from class: HttpClientCall
Returns the response entity stream if it exists.

Specified by:
getResponseEntityStream in class HttpClientCall
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: HttpCall
Indicates if the client wants a persistent connection.

Overrides:
isClientKeepAlive in class HttpClientCall
Returns:
True if the client wants a persistent connection.

parseResponse

protected void parseResponse()
                      throws java.io.IOException
Parses the HTTP response.

Throws:
java.io.IOException

sendRequest

public Status sendRequest(Request request)
Description copied from class: HttpClientCall
Sends the request to the client. Commits the request line, headers and optional entity and send them over the network.

Overrides:
sendRequest in class HttpClientCall
Parameters:
request - The high-level request.
Returns:
the status of the communication


Copyright © 2005-2008 Noelios Technologies.