Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

raining.protocol.http
Class HttpRequest  view HttpRequest download HttpRequest.java

java.lang.Object
  extended byraining.protocol.http.HttpRequest
All Implemented Interfaces:
raining.core.Request

public class HttpRequest
extends java.lang.Object
implements raining.core.Request

Class for representing HttpRequests. The server uses this to retrieve operations, and urls/paths from a request. RK added on 20031206 00:06:31 : added parsing of request using MessageHeader class. The URL etc should also be done from here.


Field Summary
protected  java.lang.String[] a
          split version of incoming string
protected  java.lang.String data
          incoming request string, as-is.
private static java.lang.String P
           
protected  sun.net.www.MessageHeader properties
           
protected  java.nio.channels.SocketChannel sc
           
 
Constructor Summary
HttpRequest(java.nio.channels.SocketChannel sc, java.lang.String mdata)
          constructor taking a SocketChannel and the incoming request.
 
Method Summary
 java.lang.String findValue(java.lang.String key)
          get a header fields value.
 java.nio.channels.SocketChannel getChannel()
           
 java.lang.String getOperation()
          returns operation : e.g.GET or POST.
 java.lang.String getURL()
          returns the url such as / or index.html.
static void main(java.lang.String[] args)
           
 void setChannel(java.nio.channels.SocketChannel sc)
           
 void setURL(java.lang.String url)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected java.lang.String data
incoming request string, as-is.


sc

protected java.nio.channels.SocketChannel sc

a

protected java.lang.String[] a
split version of incoming string


properties

protected sun.net.www.MessageHeader properties

P

private static final java.lang.String P
See Also:
Constant Field Values
Constructor Detail

HttpRequest

public HttpRequest(java.nio.channels.SocketChannel sc,
                   java.lang.String mdata)
constructor taking a SocketChannel and the incoming request. the request would be like "GET / HTTP/1.1" or "GET /index.html HTTP/1.1". THe split assumes there are no extra spaces, for that i would have to use a slower re, or modify my split to gobble consecutive delimiters.

Method Detail

getOperation

public java.lang.String getOperation()
returns operation : e.g.GET or POST.

Specified by:
getOperation in interface raining.core.Request

getURL

public java.lang.String getURL()
returns the url such as / or index.html.

Specified by:
getURL in interface raining.core.Request

getChannel

public java.nio.channels.SocketChannel getChannel()
Specified by:
getChannel in interface raining.core.Request

setChannel

public void setChannel(java.nio.channels.SocketChannel sc)
Specified by:
setChannel in interface raining.core.Request

setURL

public void setURL(java.lang.String url)
Specified by:
setURL in interface raining.core.Request

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).

Specified by:
toString in interface raining.core.Request

findValue

public java.lang.String findValue(java.lang.String key)
Description copied from interface: raining.core.Request
get a header fields value. RK added on 20031206 00:43:36 to get if-modified-since like headers.

Specified by:
findValue in interface raining.core.Request

main

public static void main(java.lang.String[] args)