More information: http://www.cs.berkeley.edu/~mdw/proj/seda/

seda.sandStorm.lib.http
Class httpRequest

java.lang.Object
  |
  +--seda.sandStorm.core.TimeStampedEvent
        |
        +--seda.sandStorm.lib.http.httpRequest
All Implemented Interfaces:
ClassQueueElementIF, httpConst, QueueElementIF

public class httpRequest
extends TimeStampedEvent
implements httpConst, ClassQueueElementIF

This class represents a single HTTP client request.

Author:
Matt Welsh

Field Summary
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.
static java.lang.String QUERY_KEY_SET
          Default value for a query key.
static int REQUEST_GET
          getRequest() code corresponding to a GET request.
static int REQUEST_POST
          getRequest() code corresponding to a POST request.
 
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
(package private) 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
 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).
 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

REQUEST_GET

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

REQUEST_POST

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

HTTPVER_09

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

HTTPVER_10

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

HTTPVER_11

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

QUERY_KEY_SET

public static final java.lang.String QUERY_KEY_SET
Default value for a query key.
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.
Method Detail

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).

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

More information: http://www.cs.berkeley.edu/~mdw/proj/seda/