CADI.Common.Network.HTTP
Class HTTPRequest

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

public class HTTPRequest
extends java.lang.Object

Version:
1.2 2009/08/30
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  java.util.Hashtable<java.lang.String,java.lang.String> headers
          Contains the HTTP request headers.
private  java.lang.String method
          Indicates the HTTP request method.
private  java.net.URI uri
          The requested URI.
private  java.lang.String version
          Indicates the HTTP version.
 
Constructor Summary
HTTPRequest()
          Constructor.
 
Method Summary
 void addHeader(java.lang.String key, java.lang.String value)
          Adds a new HTTP header.
 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.
 java.util.Hashtable<java.lang.String,java.lang.String> getHTTPHeaders()
          Returns the headers attribute.
 java.lang.String getRequestMethod()
          Returns the request method.
 java.lang.String getRequestURI()
          Returns the request URI.
 java.net.URI getURI()
          Returns the uri attribute.
 java.lang.String getVersion()
          Returns the HTTP version.
 void list(java.io.PrintStream out)
          Prints this HTTPRequest out to the specified output stream.
 void reset()
          Sets the attributes to its initial values.
 void setHeaderField(java.lang.String name, java.lang.String value)
          Puts the value of the named header field.
 void setHeaders(java.util.Hashtable<java.lang.String,java.lang.String> headers)
          Set the headers attribute.
 void setRequestMethod(java.lang.String method)
          Sets the method that will be used to send the HTTP request.
 void setRequestURI(java.lang.String uri)
          Sets the request URI.
 void setURI(java.lang.String uri)
           
 void setURI(java.net.URI uri)
           
 void setVersion(java.lang.String version)
          Sets the HTTP version.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

method

private java.lang.String method
Indicates the HTTP request method.


uri

private java.net.URI uri
The requested URI.


version

private java.lang.String version
Indicates the HTTP version.


headers

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

Constructor Detail

HTTPRequest

public HTTPRequest()
Constructor.

Method Detail

setRequestMethod

public void setRequestMethod(java.lang.String method)
Sets the method that will be used to send the HTTP request.

Parameters:
method - the method to be used in the HTTP request.
Throws:
java.net.ProtocolException

getRequestMethod

public java.lang.String getRequestMethod()
Returns the request method.

Returns:
the HTTP request method.

setVersion

public void setVersion(java.lang.String version)
Sets the HTTP version.

Parameters:
version - the HTTP version.

getVersion

public java.lang.String getVersion()
Returns the HTTP version.

Returns:
the HTTP version.

setRequestURI

public void setRequestURI(java.lang.String uri)
Sets the request URI.

Parameters:
uri - the request URI.

setURI

public void setURI(java.lang.String uri)
            throws java.net.URISyntaxException
Parameters:
uri -
Throws:
java.net.URISyntaxException

setURI

public void setURI(java.net.URI uri)
            throws java.net.URISyntaxException
Parameters:
uri -
Throws:
java.net.URISyntaxException

getURI

public java.net.URI getURI()
Returns the uri attribute.

Returns:
the uri attribute.

getRequestURI

public java.lang.String getRequestURI()
Returns the request URI.

Returns:
the request URI.

setHeaders

public void setHeaders(java.util.Hashtable<java.lang.String,java.lang.String> headers)
Set the headers attribute.

Parameters:
headers - defined in headers.

addHeader

public void addHeader(java.lang.String key,
                      java.lang.String value)
Adds a new HTTP header.

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

setHeaderField

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

This method will be deprecated and replaced by the addHeader(String, String).

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.

getHTTPHeaders

public java.util.Hashtable<java.lang.String,java.lang.String> getHTTPHeaders()
Returns the headers attribute.

Returns:
the headers attribute.

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 its initial values.


toString

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

list

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