ittp.protocol.request
Class Request

java.lang.Object
  extended byittp.protocol.Protocol
      extended byittp.protocol.request.Request
Direct Known Subclasses:
Get, Head, Option, Trace

public abstract class Request
extends Protocol

This class build the request send by the client.

Author:
Frederic Bidon and Mathieu Texier

Nested Class Summary
 class Request.Headers
          Abstract class headers that allows to build the different headers for the request.
 
Field Summary
static java.lang.String CONNECTION
          Declaration of the different headers send in a request
static java.lang.String DATE
           
static int GET
          Attribute a value to each method for differenciate them.
static int HEAD
           
static java.lang.String HOST
           
protected  int Id
           
static java.lang.String[] methodName
          Creation of a string array containing the different method that can be used.
static java.lang.String MODIFIED_SINCE
           
static int OPTIONS
           
static java.lang.String RANGE
           
static int TRACE
           
 
Fields inherited from class ittp.protocol.Protocol
dateFormat, ITTP_version, VERSION
 
Constructor Summary
Request()
           
 
Method Summary
 java.io.File getFile()
          Accessors that allows to return the name of file requested by the client.
 Request.Headers getHeaders(java.lang.String headerString)
          Accessor for the object Headers of request
 java.net.InetAddress getIP()
          Accessors that allows to return the IP requested by the client.
abstract  void process(Response response)
           
 void setHost(java.lang.String host)
          Mutators for the String host.
 void setIP(java.net.InetAddress clientIP)
          Mutators for the ClientIP.
 void setPath(java.lang.String RelativePath)
          Mutators for the String RelativePath.
 void setPort(int port)
          Mutators for the int port.
 void setSheme(java.lang.String sheme)
          Mutators for the String sheme.
 java.net.InetAddress toIP(java.lang.String host)
           
 java.lang.String toString()
          Convert to a string the headers request.
 
Methods inherited from class ittp.protocol.Protocol
getITTP_version, setITTP_version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECTION

public static final java.lang.String CONNECTION
Declaration of the different headers send in a request

See Also:
Constant Field Values

DATE

public static final java.lang.String DATE
See Also:
Constant Field Values

HOST

public static final java.lang.String HOST
See Also:
Constant Field Values

MODIFIED_SINCE

public static final java.lang.String MODIFIED_SINCE
See Also:
Constant Field Values

RANGE

public static final java.lang.String RANGE
See Also:
Constant Field Values

GET

public static final int GET
Attribute a value to each method for differenciate them.

See Also:
Constant Field Values

HEAD

public static final int HEAD
See Also:
Constant Field Values

OPTIONS

public static final int OPTIONS
See Also:
Constant Field Values

TRACE

public static final int TRACE
See Also:
Constant Field Values

methodName

public static final java.lang.String[] methodName
Creation of a string array containing the different method that can be used.


Id

protected int Id
Constructor Detail

Request

public Request()
Method Detail

process

public abstract void process(Response response)

getHeaders

public Request.Headers getHeaders(java.lang.String headerString)
Accessor for the object Headers of request

Parameters:
headerString - String containing the name of the header.
Returns:
an object Headers correponding to the name headerstring.

getFile

public java.io.File getFile()
Accessors that allows to return the name of file requested by the client.

Returns:
the file.

getIP

public java.net.InetAddress getIP()
Accessors that allows to return the IP requested by the client.

Returns:
an InetAddress ip.

setIP

public void setIP(java.net.InetAddress clientIP)
Mutators for the ClientIP.

Parameters:
clientIP - InetAddress that contain the IP address.

setSheme

public void setSheme(java.lang.String sheme)
Mutators for the String sheme.

Parameters:
sheme - String that contain the protocol use to communicate.

toIP

public java.net.InetAddress toIP(java.lang.String host)

setHost

public void setHost(java.lang.String host)
Mutators for the String host.

Parameters:
host - String that the name of the host requested by the client.

setPort

public void setPort(int port)
Mutators for the int port.

Parameters:
port - int that determine the number of port used to communicate.

setPath

public void setPath(java.lang.String RelativePath)
Mutators for the String RelativePath.

Parameters:
RelativePath - String that determines relative path.

toString

public java.lang.String toString()
Convert to a string the headers request.

Returns:
a string containing the request of the client.