CADI.Server.Request
Class HTTPRequestReader

java.lang.Object
  extended by CADI.Server.Request.HTTPRequestReader
All Implemented Interfaces:
StatusCodes

public class HTTPRequestReader
extends java.lang.Object
implements StatusCodes

This class reads HTTP client requests. This class only a simple parse of the requests, chech that the request line had the method, request URI, and the HTTP protocol version. Regarding the HTTP headers, it only check that the header keys were an allowed key.

Usage example:
  construct
  readHTTPRequest

Version:
1.1.1 2009/08/16
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  HTTPRequest httpRequest
          Stores the http request sent by a client.
private static java.util.Set httpRequestHeaders
           
private static java.lang.String[] httpRequestHeadersList
          Allowed HTTP request headers
private static java.util.Set methods
           
private static java.lang.String[] methodsList
          Allowed HTTP methods
 
Fields inherited from interface CADI.Common.Network.HTTP.StatusCodes
ACCEPTED, BAD_REQUEST, NOT_FOUND, NOT_IMPLEMENTED, OK, SERVICE_UNAVAILABLE, UNSUPPORTED_MEDIA_TYPE
 
Constructor Summary
HTTPRequestReader()
          Constructor.
 
Method Summary
 HTTPRequest getHTTPRequest()
          Returns the httpRequest attribute.
 void list(java.io.PrintStream out)
          Prints this HTTP Request Reader fields out to the specified output stream.
 HTTPRequest readHTTPRequest(java.io.BufferedReader bufferedReader)
          Reads a HTTP request from the socket.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

httpRequest

private HTTPRequest httpRequest
Stores the http request sent by a client.


methodsList

private static final java.lang.String[] methodsList
Allowed HTTP methods


methods

private static final java.util.Set methods
See Also:
methodsList

httpRequestHeadersList

private static final java.lang.String[] httpRequestHeadersList
Allowed HTTP request headers


httpRequestHeaders

private static final java.util.Set httpRequestHeaders
See Also:
httpRequestHeadersList
Constructor Detail

HTTPRequestReader

public HTTPRequestReader()
Constructor.

Method Detail

readHTTPRequest

public HTTPRequest readHTTPRequest(java.io.BufferedReader bufferedReader)
                            throws ErrorException,
                                   java.net.SocketTimeoutException,
                                   java.io.IOException
Reads a HTTP request from the socket.

Parameters:
bufferedReader - buffered reader where the http request will be read.
Throws:
ErrorException
java.net.SocketTimeoutException
java.io.IOException

getHTTPRequest

public HTTPRequest getHTTPRequest()
Returns the httpRequest attribute.

Returns:
the httpRequest attribute.

toString

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

list

public void list(java.io.PrintStream out)
Prints this HTTP Request Reader fields out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.


CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) (contact)