de.unkrig.commons.net.http
Class HttpClient

java.lang.Object
  extended by de.unkrig.commons.net.http.HttpClient
All Implemented Interfaces:
java.io.Closeable

public final class HttpClient
extends java.lang.Object
implements java.io.Closeable

Implementation of an HTTP client.

See Also:
HttpClient(InetAddress, int)

Constructor Summary
HttpClient(java.net.InetAddress address, int port)
          Connects to the given address and port.
HttpClient(java.lang.String host, int port)
           
 
Method Summary
 HttpResponse call(HttpRequest httpRequest)
          Sends the given httpRequest to the server, waits for the response from the server.
 void close()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClient

public HttpClient(java.lang.String host,
                  int port)
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
HttpClient(InetAddress, int)

HttpClient

public HttpClient(java.net.InetAddress address,
                  int port)
           throws java.io.IOException
Connects to the given address and port.

Throws:
java.io.IOException
Method Detail

call

public HttpResponse call(HttpRequest httpRequest)
                  throws java.io.IOException
Sends the given httpRequest to the server, waits for the response from the server.

Returns:
The parsed response from the server
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException