jodd.io.http
Class Http

java.lang.Object
  extended by jodd.io.http.Http

public class Http
extends java.lang.Object

HTTP util class for creating request and response HttpTransfer.


Constructor Summary
Http()
           
 
Method Summary
static HttpTransfer createRequest(java.lang.String method, java.lang.String fullUrl)
          Creates request HttpTransfer.
static HttpTransfer createRequest(java.lang.String method, java.lang.String hostName, int port, java.lang.String path)
          Creates request HttpTransfer.
static HttpTransfer createResponse(int statusCode, java.lang.String statusPhrase)
          Creates simple response HttpTransfer.
protected static void readBody(HttpTransfer httpTransfer, java.io.BufferedReader reader)
           
protected static void readHeaders(HttpTransfer httpTransfer, java.io.BufferedReader reader)
           
static HttpTransfer readRequest(java.io.InputStream in)
          Reads HttpTransfer from incoming request.
static HttpTransfer readResponse(java.net.HttpURLConnection huc)
          Reads response from HTTP URL connection.
static HttpTransfer readResponse(java.io.InputStream in)
          Reads response input stream and returns response HttpTransfer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Http

public Http()
Method Detail

createRequest

public static HttpTransfer createRequest(java.lang.String method,
                                         java.lang.String fullUrl)
                                  throws java.io.IOException
Creates request HttpTransfer.

Throws:
java.io.IOException
See Also:
createRequest(String, String, int, String)

createRequest

public static HttpTransfer createRequest(java.lang.String method,
                                         java.lang.String hostName,
                                         int port,
                                         java.lang.String path)
Creates request HttpTransfer. Also sets the "Hosts" header.


readRequest

public static HttpTransfer readRequest(java.io.InputStream in)
                                throws java.io.IOException
Reads HttpTransfer from incoming request.

Throws:
java.io.IOException

createResponse

public static HttpTransfer createResponse(int statusCode,
                                          java.lang.String statusPhrase)
Creates simple response HttpTransfer.


readResponse

public static HttpTransfer readResponse(java.io.InputStream in)
                                 throws java.io.IOException
Reads response input stream and returns response HttpTransfer. Supports both streamed and chunked response.

Throws:
java.io.IOException

readResponse

public static HttpTransfer readResponse(java.net.HttpURLConnection huc)
                                 throws java.io.IOException
Reads response from HTTP URL connection.

Throws:
java.io.IOException

readHeaders

protected static void readHeaders(HttpTransfer httpTransfer,
                                  java.io.BufferedReader reader)
                           throws java.io.IOException
Throws:
java.io.IOException

readBody

protected static void readBody(HttpTransfer httpTransfer,
                               java.io.BufferedReader reader)
                        throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2003-2012 Jodd Team