CADI.Common.Network.HTTP
Class HTTPResponse

java.lang.Object
  extended by CADI.Common.Network.HTTP.HTTPResponse

public class HTTPResponse
extends java.lang.Object

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

Field Summary
private  java.util.Hashtable<java.lang.String,java.lang.String> headers
          Contains the HTTP response headers.
private  int responseCode
          An int representing the three digit HTTP Status-Code.
private  java.lang.String responseMessage
          It is a short description of the status code provided by the server
 
Constructor Summary
HTTPResponse()
          Constructor.
 
Method Summary
 java.lang.String getHeaderField(java.lang.String name)
          Returns the value of the named header field.
 java.util.Enumeration<java.lang.String> getHeaders()
          Returns an unmodifiable Enumeration of the header names.
 int getResponseCode()
          Retuns the response code.
 java.lang.String getResponseMessage()
          Returns the response message.
 void list(java.io.PrintStream out)
          Prints this HTTPResponse out to the specified output stream.
 void reset()
          Sets the attributes to inital values.
 void setHeaderField(java.lang.String name, java.lang.String value)
          Puts the value of the named header field.
 void setResponseCode(int responseCode)
          Sets the response code.
 void setResponseMessage(java.lang.String responseMessage)
          Sets the response message.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

responseCode

private int responseCode
An int representing the three digit HTTP Status-Code. Allowed values in StatusCodes


responseMessage

private java.lang.String responseMessage
It is a short description of the status code provided by the server


headers

private java.util.Hashtable<java.lang.String,java.lang.String> headers
Contains the HTTP response headers.

Constructor Detail

HTTPResponse

public HTTPResponse()
Constructor.

Method Detail

setResponseCode

public void setResponseCode(int responseCode)
Sets the response code.

Parameters:
responseCode - the response code value.

getResponseCode

public int getResponseCode()
Retuns the response code.

Returns:
the response code.

setResponseMessage

public void setResponseMessage(java.lang.String responseMessage)
Sets the response message.

Parameters:
responseMessage - the response message.

getResponseMessage

public java.lang.String getResponseMessage()
Returns the response message.

Returns:
the response message.

setHeaderField

public void setHeaderField(java.lang.String name,
                           java.lang.String value)
Puts the value of the named header field.

Parameters:
name - the name of the header field.
value - the value of the header field.

getHeaderField

public java.lang.String getHeaderField(java.lang.String name)
Returns the value of the named header field.

If called on a connection that sets the same header multiple times with possibly different values, only the last value is returned.

Parameters:
name - the name of a header field.
Returns:
the value of the named header field, or null if there is no such field in the header.

getHeaders

public java.util.Enumeration<java.lang.String> getHeaders()
Returns an unmodifiable Enumeration of the header names.

The Enumeration keys are Strings that represent the response-header field names.

Returns:
a Enumeration of header fields names.

reset

public void reset()
Sets the attributes to inital values.


toString

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

list

public void list(java.io.PrintStream out)
Prints this HTTPResponse 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)