ittp.protocol.response
Class Response

java.lang.Object
  extended byittp.protocol.Protocol
      extended byittp.protocol.response.Response

public class Response
extends Protocol

This class build the response send to the client according to the method and the headers.

Author:
Frederic Bidon and Mathieu Texier

Nested Class Summary
 class Response.Body
          This class create the body of the response according to the request of the client.
 class Response.Code
          This class allow to know the state of the response.
 class Response.Headers
          Abstract class headers that allows to build the different headers for the response.
 
Field Summary
static java.lang.String ALLOW
          Declaration of the different headers send in a response
 Response.Body body
           
 Response.Code code
           
static java.lang.String CONNECTION
           
static java.lang.String CONTENT_LENGTH
           
static java.lang.String CONTENT_MD5
           
static java.lang.String CONTENT_RANGE
           
static java.lang.String CONTENT_TYPE
           
static java.lang.String DATE
           
 Response.Headers headers
           
static java.lang.String HOST
           
static java.lang.String LAST_MODIFIED
           
static java.lang.String SERVER
           
 
Fields inherited from class ittp.protocol.Protocol
dateFormat, ITTP_version, VERSION
 
Constructor Summary
Response()
          Creates a new instance of Headers
 
Method Summary
 Response.Headers getHeaders(java.lang.String headerString)
          Accessor for the object Headers
 void setVirtualBody(boolean virtualBody)
          Mutators for the boolean virtualBody
 java.io.InputStream toStream()
          Method to convert the headers and the body to an InputStream.
 java.lang.String toString()
          Method to convert the response to a string.
 
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

code

public Response.Code code

headers

public Response.Headers headers

body

public Response.Body body

ALLOW

public static final java.lang.String ALLOW
Declaration of the different headers send in a response

See Also:
Constant Field Values

CONNECTION

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

CONTENT_LENGTH

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

CONTENT_MD5

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

CONTENT_RANGE

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

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
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

LAST_MODIFIED

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

SERVER

public static final java.lang.String SERVER
See Also:
Constant Field Values
Constructor Detail

Response

public Response()
Creates a new instance of Headers

Method Detail

getHeaders

public Response.Headers getHeaders(java.lang.String headerString)
Accessor for the object Headers

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

toString

public java.lang.String toString()
Method to convert the response to a string. The response can contain the body and the headers or just the headers.

Returns:
the String retString containing the response of the server.

toStream

public java.io.InputStream toStream()
Method to convert the headers and the body to an InputStream. This stream can contain the stream of the body and the headers or just the stream of the headers.

Returns:
an InputStream containin the stream of the response

setVirtualBody

public void setVirtualBody(boolean virtualBody)
Mutators for the boolean virtualBody