com.noelios.restlet.ext.net
Class HttpUrlConnectionCall

java.lang.Object
  extended by com.noelios.restlet.http.HttpCall
      extended by com.noelios.restlet.http.HttpClientCall
          extended by com.noelios.restlet.ext.net.HttpUrlConnectionCall

public class HttpUrlConnectionCall
extends HttpClientCall

HTTP client connector call based on JDK's java.net.HttpURLConnection class.

Author:
Jerome Louvel

Constructor Summary
HttpUrlConnectionCall(HttpClientHelper helper, java.lang.String method, java.lang.String requestUri, boolean hasEntity)
          Constructor.
 
Method Summary
 java.net.HttpURLConnection getConnection()
          Returns the connection.
 HttpClientHelper getHelper()
          Returns the HTTP client helper.
 java.lang.String getReasonPhrase()
          Returns the response reason phrase.
protected  Representation getRepresentation(java.io.InputStream stream)
           
 java.nio.channels.WritableByteChannel getRequestEntityChannel()
           
 java.io.OutputStream getRequestEntityStream()
           
 java.io.OutputStream getRequestHeadStream()
           
 java.io.OutputStream getRequestStream()
          Returns the request entity stream if it exists.
 java.nio.channels.ReadableByteChannel getResponseEntityChannel(long size)
           
 java.io.InputStream getResponseEntityStream(long size)
           
 Series<Parameter> getResponseHeaders()
          Returns the modifiable list of response headers.
 java.lang.String getServerAddress()
          Returns the response address.
Corresponds to the IP address of the responding server.
 int getStatusCode()
          Returns the response status code.
 Status sendRequest(Request request)
          Sends the request to the client.
 
Methods inherited from class com.noelios.restlet.http.HttpClientCall
copyResponseEntityHeaders, getContentLength, getLocalAddress, getRepresentation, getResponseEntity, isClientKeepAlive, isServerKeepAlive, parseContentDisposition, shouldRequestBeChunked
 
Methods inherited from class com.noelios.restlet.http.HttpCall
formatDate, getClientAddress, getClientPort, getConnectorService, getContentLength, getHostDomain, getHostPort, getLogger, getMethod, getProtocol, getRequestHeaders, getRequestUri, getServerPort, 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

HttpUrlConnectionCall

public HttpUrlConnectionCall(HttpClientHelper helper,
                             java.lang.String method,
                             java.lang.String requestUri,
                             boolean hasEntity)
                      throws java.io.IOException
Constructor.

Parameters:
helper - The parent HTTP client helper.
method - The method name.
requestUri - The request URI.
hasEntity - Indicates if the call will have an entity to send to the server.
Throws:
java.io.IOException
Method Detail

getConnection

public java.net.HttpURLConnection getConnection()
Returns the connection.

Returns:
The connection.

getHelper

public HttpClientHelper getHelper()
Returns the HTTP client helper.

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

getReasonPhrase

public java.lang.String getReasonPhrase()
Returns the response reason phrase.

Overrides:
getReasonPhrase in class HttpCall
Returns:
The response reason phrase.

getRepresentation

protected Representation getRepresentation(java.io.InputStream stream)
Overrides:
getRepresentation in class HttpClientCall

getRequestEntityChannel

public java.nio.channels.WritableByteChannel getRequestEntityChannel()
Specified by:
getRequestEntityChannel in class HttpClientCall

getRequestEntityStream

public java.io.OutputStream getRequestEntityStream()
Specified by:
getRequestEntityStream in class HttpClientCall

getRequestHeadStream

public java.io.OutputStream getRequestHeadStream()
Specified by:
getRequestHeadStream in class HttpClientCall

getRequestStream

public java.io.OutputStream getRequestStream()
Returns the request entity stream if it exists.

Returns:
The request entity stream if it exists.

getResponseEntityChannel

public java.nio.channels.ReadableByteChannel getResponseEntityChannel(long size)
Specified by:
getResponseEntityChannel in class HttpClientCall

getResponseEntityStream

public java.io.InputStream getResponseEntityStream(long size)
Specified by:
getResponseEntityStream in class HttpClientCall

getResponseHeaders

public Series<Parameter> getResponseHeaders()
Returns the modifiable list of response headers.

Overrides:
getResponseHeaders in class HttpCall
Returns:
The modifiable list of response headers.

getServerAddress

public java.lang.String getServerAddress()
Returns the response address.
Corresponds to the IP address of the responding server.

Overrides:
getServerAddress in class HttpCall
Returns:
The response address.

getStatusCode

public int getStatusCode()
                  throws java.io.IOException
Returns the response status code.

Overrides:
getStatusCode in class HttpCall
Returns:
The response status code.
Throws:
java.io.IOException
java.io.IOException

sendRequest

public Status sendRequest(Request request)
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 result status.


Copyright © 2005-2008 Noelios Technologies.