seda.sandStorm.lib.http
Class httpRequest

java.lang.Object
  extended by seda.sandStorm.core.TimeStampedEvent
      extended by seda.sandStorm.lib.http.httpRequest
All Implemented Interfaces:
ClassQueueElementIF, QueueElementIF, httpConst

public class httpRequest
extends TimeStampedEvent
implements httpConst, ClassQueueElementIF

This class represents a single HTTP client request.


Field Summary
private  httpConnection conn
           
private static boolean DEBUG
           
private  java.util.Hashtable header
           
private  int httpver
           
static int HTTPVER_09
          getHttpVer() code corresponding to HTTP/0.9.
static int HTTPVER_10
          getHttpVer() code corresponding to HTTP/1.0.
static int HTTPVER_11
          getHttpVer() code corresponding to HTTP/1.1.
private  java.util.Hashtable query
           
static java.lang.String QUERY_KEY_SET
          Default value for a query key.
private  java.util.Vector rawHeader
           
private  int request
           
static int REQUEST_GET
          getRequest() code corresponding to a GET request.
static int REQUEST_POST
          getRequest() code corresponding to a POST request.
private  java.lang.String url
           
private  int user_class
           
 
Fields inherited from class seda.sandStorm.core.TimeStampedEvent
timestamp
 
Fields inherited from interface seda.sandStorm.lib.http.httpConst
CRLF, DEFAULT_HTTP_PORT, HTTP_VERSION, WRITE_CLOG_THRESHOLD
 
Constructor Summary
httpRequest(httpConnection conn, java.lang.String requestStr, java.lang.String url, int httpver, java.util.Vector header)
          Package-internal: Create an httpRequest from the given connection, request string, URL, HTTP version, and header.
 
Method Summary
private  java.lang.String decodeURL(java.lang.String encoded)
           
 httpConnection getConnection()
          Return the corresponding HTTP connection.
 java.lang.String getHeader(java.lang.String key)
          Return the header line corresponding to the given key.
 int getHttpVer()
          Return the code corresponding to the HTTP version.
 java.lang.String getQuery(java.lang.String key)
          Return the value associated with the given query key.
 java.util.Enumeration getQueryKeys()
          Return an enumeration of keys in the query string, if any.
 java.lang.String[] getQuerySet(java.lang.String key)
          Return the set of values associated with the given query key.
 int getRequest()
          Return the code corresponding to the request.
 int getRequestClass()
           
 java.lang.String getURL()
          Return the request URL.
 boolean headerNeeded()
          Indicates whether this request requires a header to be sent in the response (that is, whether this is HTTP/1.0 or later).
private  void parseHeader()
           
private  void putVal(java.lang.String key, java.lang.String val)
           
 void setRequestClass(int theclass)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

REQUEST_GET

public static final int REQUEST_GET
getRequest() code corresponding to a GET request.

See Also:
Constant Field Values

REQUEST_POST

public static final int REQUEST_POST
getRequest() code corresponding to a POST request.

See Also:
Constant Field Values

HTTPVER_09

public static final int HTTPVER_09
getHttpVer() code corresponding to HTTP/0.9.

See Also:
Constant Field Values

HTTPVER_10

public static final int HTTPVER_10
getHttpVer() code corresponding to HTTP/1.0.

See Also:
Constant Field Values

HTTPVER_11

public static final int HTTPVER_11
getHttpVer() code corresponding to HTTP/1.1.

See Also:
Constant Field Values

QUERY_KEY_SET

public static final java.lang.String QUERY_KEY_SET
Default value for a query key.

See Also:
Constant Field Values

conn

private httpConnection conn

request

private int request

url

private java.lang.String url

httpver

private int httpver

user_class

private int user_class

rawHeader

private java.util.Vector rawHeader

header

private java.util.Hashtable header

query

private java.util.Hashtable query
Constructor Detail

httpRequest

httpRequest(httpConnection conn,
            java.lang.String requestStr,
            java.lang.String url,
            int httpver,
            java.util.Vector header)
      throws java.io.IOException
Package-internal: Create an httpRequest from the given connection, request string, URL, HTTP version, and header.

Throws:
java.io.IOException
Method Detail

decodeURL

private java.lang.String decodeURL(java.lang.String encoded)

putVal

private void putVal(java.lang.String key,
                    java.lang.String val)

getRequest

public int getRequest()
Return the code corresponding to the request. Each code has one of the REQUEST_* values from this class.


getURL

public java.lang.String getURL()
Return the request URL.


getHttpVer

public int getHttpVer()
Return the code corresponding to the HTTP version. Each code has one of the HTTPVER_* values from this class.


getConnection

public httpConnection getConnection()
Return the corresponding HTTP connection.


getHeader

public java.lang.String getHeader(java.lang.String key)
Return the header line corresponding to the given key. For example, to get the 'User-Agent' field from the header, use getHeader("User-Agent").


getQueryKeys

public java.util.Enumeration getQueryKeys()
Return an enumeration of keys in the query string, if any.


getQuery

public java.lang.String getQuery(java.lang.String key)
Return the value associated with the given query key. If a key as more than one value then only the first value will be returned.


getQuerySet

public java.lang.String[] getQuerySet(java.lang.String key)
Return the set of values associated with the given query key.


headerNeeded

public boolean headerNeeded()
Indicates whether this request requires a header to be sent in the response (that is, whether this is HTTP/1.0 or later).


parseHeader

private void parseHeader()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRequestClass

public int getRequestClass()
Specified by:
getRequestClass in interface ClassQueueElementIF

setRequestClass

public void setRequestClass(int theclass)
Specified by:
setRequestClass in interface ClassQueueElementIF