com.flat502.rox.http
Class HttpRequest

java.lang.Object
  extended by com.flat502.rox.http.HttpMessage
      extended by com.flat502.rox.http.HttpRequest

public class HttpRequest
extends HttpMessage

This class represents an HTTP request and supports streaming that request out to an indicated stream.


Constructor Summary
HttpRequest(java.lang.String method, java.lang.String uri, Encoding encoding)
          Constructs a new instance using a given HTTP method and URI.
 
Method Summary
protected  void marshalStartLine(java.io.OutputStream os)
          Constructs and returns the HTTP request line for this request.
 
Methods inherited from class com.flat502.rox.http.HttpMessage
addHeader, formatDate, getHeaderValue, getStartLine, getVersionString, isHeaderSet, marshal, marshal, marshalContent, marshalHeaders, normalizeHeaderName, setContent, setHeader, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpRequest

public HttpRequest(java.lang.String method,
                   java.lang.String uri,
                   Encoding encoding)
Constructs a new instance using a given HTTP method and URI.

The URI provided is normalized by a call to Utils.normalizeURIPath(String).

Parameters:
method - The HTTP method to use in this request. May not be null.
uri - The URI to include in this request. May not be null.
encoding - An Encoding describing the encoding to use when constructing this message. This also informs the Content-Encoding header value. May be null.
Method Detail

marshalStartLine

protected void marshalStartLine(java.io.OutputStream os)
                         throws java.io.IOException
Constructs and returns the HTTP request line for this request.

The request line is defined in section 5.1 of RFC 2616 and consists of the following three values delimited by spaces:

  1. The HTTP method set in the constructor.
  2. The request URI set in the constructor.
  3. The HTTP version returned by HttpMessage.getVersionString().

Specified by:
marshalStartLine in class HttpMessage
Parameters:
os - The stream to write the start line to.
Throws:
java.io.IOException