org.modeshape.web.jcr.rest.client.http
Class HttpClientConnection

java.lang.Object
  extended by org.modeshape.web.jcr.rest.client.http.HttpClientConnection

public final class HttpClientConnection
extends Object

HttpClientConnection uses the Apache HttpClient.


Constructor Summary
HttpClientConnection(Server server, URL url, IJsonConstants.RequestMethod method)
           
 
Method Summary
 void disconnect()
          Disconnects this connection.
 int getResponseCode()
           
 String read()
           
 void write(byte[] bytes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientConnection

public HttpClientConnection(Server server,
                            URL url,
                            IJsonConstants.RequestMethod method)
                     throws Exception
Parameters:
server - the server with the host and port information (never null)
url - the URL that will be used in the request (never null)
method - the HTTP request method (never null)
Throws:
Exception - if there is a problem establishing the connection
Method Detail

disconnect

public void disconnect()
Disconnects this connection.


getResponseCode

public int getResponseCode()
                    throws Exception
Returns:
the HTTP response code
Throws:
Exception - if there is a problem getting the response code

read

public String read()
            throws Exception
Returns:
the HTTP response body as a string
Throws:
Exception - if there is a problem reading from the connection

write

public void write(byte[] bytes)
           throws Exception
Parameters:
bytes - the bytes being posted to the HTTP connection (never null)
Throws:
Exception - if there is a problem writing to the connection


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.