com.monoserv.http
Class HttpRequest

java.lang.Object
  extended by com.monoserv.http.HttpRequest

public class HttpRequest
extends java.lang.Object

Obtains and parses the information in an HTTP request.


Constructor Summary
protected HttpRequest()
           
 
Method Summary
 boolean doesQueryFieldExist(java.lang.String fieldName)
          Returns true if a field in the query string exists.
 java.lang.String getHttpMethod()
          Returns the HTTP method as a string.
 HttpParameters getHttpParameters()
          Returns a copy of the HTTP headers that were sent along with this request.
 java.lang.String getHttpUri()
          Returns the URI that was parsed from the request.
 java.lang.String getHttpVersion()
          Returns the HTTP version in String format.
static HttpRequest makeRequest(java.lang.String httpMsg)
          This takes the entire HTTP message in its entirety and parses it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpRequest

protected HttpRequest()
Method Detail

getHttpMethod

public java.lang.String getHttpMethod()
Returns the HTTP method as a string.

Returns:
String The HTTP method

getHttpVersion

public java.lang.String getHttpVersion()
Returns the HTTP version in String format.

Returns:
String the HTTP version (0.9, 1.0, 1.1, etc)

getHttpUri

public java.lang.String getHttpUri()
Returns the URI that was parsed from the request. This does not contain an ending '?' character or any parts of the query string

Returns:
String the URI portion of the HTTP request

getHttpParameters

public HttpParameters getHttpParameters()
Returns a copy of the HTTP headers that were sent along with this request.

Returns:
HttpParameters An object filled with the HTTP headers that were sent.

doesQueryFieldExist

public boolean doesQueryFieldExist(java.lang.String fieldName)
                            throws java.lang.NullPointerException
Returns true if a field in the query string exists. The requirements for this function are that the query string parsing must have been successful, the HttpQueryString object must be non-null and the field must have been passed in. This will still return true if the field was passed in with no value associated with it.

Parameters:
fieldName - The name of the field to look up
Returns:
boolean True if the field exists in the query string, false otherwise
Throws:
java.lang.NullPointerException - If the query string is null

makeRequest

public static HttpRequest makeRequest(java.lang.String httpMsg)
This takes the entire HTTP message in its entirety and parses it. It includes the message body. Upon success it will return an object filled with information.

Parameters:
httpMsg - The whole HTTP message
Returns:
HttpRequest A HTTP request object