CADI.Server.Network
Class HTTPRequestDecoder

java.lang.Object
  extended by CADI.Server.Network.HTTPRequestDecoder
All Implemented Interfaces:
ImageReturnTypes, StatusCodes

public class HTTPRequestDecoder
extends java.lang.Object
implements StatusCodes, ImageReturnTypes

This class implements an HTTP request decoder.

Usage example:
  constructor
  decoder
  get methods
  reset
  decoder
  get methods
  reset
  ....

Version:
1.0 2007/10/26
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  HTTPRequest httpRequest
          This object contains the decoded HTTP request fields.
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
private  java.lang.String requestLine
          Contains the HTTP request line
 
Fields inherited from interface CADI.Common.Network.HTTP.StatusCodes
ACCEPTED, BAD_REQUEST, NOT_FOUND, NOT_IMPLEMENTED, OK, SERVICE_UNAVAILABLE, UNSUPPORTED_MEDIA_TYPE
 
Fields inherited from interface CADI.Common.Defaults.ImageReturnTypes
JPP_STREAM, JPT_STREAM, MAX_IMAGE_RETURN_TYPES_ALLOWED, RAW
 
Constructor Summary
HTTPRequestDecoder()
          Constructor.
 
Method Summary
private  void decoder(java.lang.String requestLine, java.util.Hashtable<java.lang.String,java.lang.String> headers)
          Decodes the HTTP request.
 void decoderBak(HTTPRequest request)
          Decodes the HTTP request.
 HTTPRequest getHTTPRequest()
          Returns the httpRequest attribue.
 java.lang.String getHTTPVersion()
          Returns the HTTP version.
 java.lang.String getMethod()
          Returns the HTTP method.
 java.lang.String getRequestURI()
          Returns the last requested URI.
 void list(java.io.PrintStream out)
          Prints this HTTPRequestDecoder out to the specified output stream.
 void reset()
          Sets the class atributes to initial values.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

requestLine

private java.lang.String requestLine
Contains the HTTP request line


httpRequest

private HTTPRequest httpRequest
This object contains the decoded HTTP request fields.


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

HTTPRequestDecoder

public HTTPRequestDecoder()
Constructor.

Method Detail

decoderBak

public void decoderBak(HTTPRequest request)
                throws ErrorException
Decodes the HTTP request.

Parameters:
request -
Throws:
WarningException - this exception will be thrown if
ErrorException

reset

public void reset()
Sets the class atributes to initial values.


getMethod

public java.lang.String getMethod()
Returns the HTTP method. See the HTTPRequest.getRequestMethod() method.

Returns:
the HTTP method.

getRequestURI

public java.lang.String getRequestURI()
Returns the last requested URI.

Returns:
the last requested URI.

getHTTPVersion

public java.lang.String getHTTPVersion()
Returns the HTTP version. See the HTTPRequest.getVersion() method.

Returns:
the HTTP version.

getHTTPRequest

public HTTPRequest getHTTPRequest()
Returns the httpRequest attribue.

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 HTTPRequestDecoder out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.

decoder

private void decoder(java.lang.String requestLine,
                     java.util.Hashtable<java.lang.String,java.lang.String> headers)
              throws ErrorException
Decodes the HTTP request.

Parameters:
requestLine - the HTTP request line to be decoded.
headers - headers of the HTTP request.
Throws:
WarningException - this exception will be thrown if
ErrorException


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)