|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rit.http.HttpRequest
public class HttpRequest
Class HttpRequest encapsulates an HTTP request received from a web browser.
HTTP/1.0 and HTTP/1.1 requests are supported. The obsolete HTTP/0.9 requests are not supported.
This class provides methods for examining the request line and the headers. This class does not support reading the entity body if any.
To receive an HTTP request message:
| Field Summary | |
|---|---|
static String |
GET_METHOD
The GET method string, "GET". |
static String |
HEAD_METHOD
The HEAD method string, "HEAD". |
static String |
HTTP_1_0_VERSION
The HTTP/1.0 version string "HTTP/1.0". |
static String |
HTTP_1_1_VERSION
The HTTP/1.1 version string, "HTTP/1.1". |
static String |
POST_METHOD
The POST method string, "POST". |
| Constructor Summary | |
|---|---|
HttpRequest(Socket theSocket)
Construct a new HTTP request. |
|
| Method Summary | |
|---|---|
String |
getHeader(String theHeaderName)
Obtain the value of the given header in this HTTP request. |
Collection<Map.Entry<String,String>> |
getHeaders()
Obtain a collection of all the headers in this HTTP request. |
String |
getHttpVersion()
Obtain this HTTP request's version. |
String |
getMethod()
Obtain this HTTP request's method. |
String |
getUri()
Obtain this HTTP request's URI. |
boolean |
isValid()
Determine if this HTTP request is valid. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String GET_METHOD
public static final String HEAD_METHOD
public static final String POST_METHOD
public static final String HTTP_1_0_VERSION
public static final String HTTP_1_1_VERSION
| Constructor Detail |
|---|
public HttpRequest(Socket theSocket)
theSocket - Socket.
NullPointerException - (unchecked exception) Thrown if theSocket is null.| Method Detail |
|---|
public boolean isValid()
public String getMethod()
IllegalStateException - (unchecked exception) Thrown if this HTTP request is invalid.public String getUri()
IllegalStateException - (unchecked exception) Thrown if this HTTP request is invalid.public String getHttpVersion()
IllegalStateException - (unchecked exception) Thrown if this HTTP request is invalid.public String getHeader(String theHeaderName)
theHeaderName - Header name.
IllegalStateException - (unchecked exception) Thrown if this HTTP request is invalid.public Collection<Map.Entry<String,String>> getHeaders()
IllegalStateException - (unchecked exception) Thrown if this HTTP request is invalid.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||