org.elkoserver.foundation.net
Class HTTPRequest

java.lang.Object
  extended by org.elkoserver.foundation.net.HTTPRequest
Direct Known Subclasses:
WebSocketRequest

public class HTTPRequest
extends Object

An HTTP request descriptor, obtained by parsing the lines of text in an HTTP request as they are received.


Method Summary
 String content()
          Get the message body content.
 String header(String name)
          Get the value of a request header field.
 boolean isNonPersistent()
          Test if this is a non-persistent connection.
 String method()
          Get the request method (GET, PUT, etc.).
 String toString()
          Obtain a printable String representation of this request.
 String URI()
          Get the URI that was requested.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

content

public String content()
Get the message body content.

Returns:
the request message body content as a string, or null if there is none.

header

public String header(String name)
Get the value of a request header field.

Parameters:
name - The header name whose value is desired.
Returns:
the value of the header named by 'name', or null if there is no such header in the request.

isNonPersistent

public boolean isNonPersistent()
Test if this is a non-persistent connection.

Returns:
true if a header line said "Connection: close".

method

public String method()
Get the request method (GET, PUT, etc.).

Returns:
the request method.

toString

public String toString()
Obtain a printable String representation of this request.

Overrides:
toString in class Object
Returns:
a printable dump of the request state.

URI

public String URI()
Get the URI that was requested.

Returns:
the requested URI.