public class HTTPRequest
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<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 and Description |
---|
HTTPRequest()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.Set<java.lang.String> |
getHeaders()
Returns an unmodifiable Enumeration of the header names.
|
java.util.HashMap<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.HashMap<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() |
private java.lang.String method
private java.net.URI uri
private java.lang.String version
private java.util.HashMap<java.lang.String,java.lang.String> headers
public void setRequestMethod(java.lang.String method)
method
- the method to be used in the HTTP request.java.net.ProtocolException
public java.lang.String getRequestMethod()
public void setVersion(java.lang.String version)
version
- the HTTP version.public java.lang.String getVersion()
public void setRequestURI(java.lang.String uri)
uri
- the request URI.public void setURI(java.lang.String uri) throws java.net.URISyntaxException
uri
- java.net.URISyntaxException
public void setURI(java.net.URI uri) throws java.net.URISyntaxException
uri
- java.net.URISyntaxException
public java.lang.String getRequestURI()
public void setHeaders(java.util.HashMap<java.lang.String,java.lang.String> headers)
headers
attribute.headers
- defined in headers
.public void addHeader(java.lang.String key, java.lang.String value)
key
- name the name of the header field.value
- the value of the header field.public void setHeaderField(java.lang.String name, java.lang.String value)
This method will be deprecated and replaced by the addHeader(String, String)
.
name
- the name of the header field.value
- the value of the header field.public java.lang.String getHeaderField(java.lang.String name)
If called on a connection that sets the same header multiple times with possibly different values, only the last value is returned.
name
- the name of a header field.null
if there is no such field in the header.public java.util.HashMap<java.lang.String,java.lang.String> getHTTPHeaders()
headers
attribute.headers
attribute.public java.util.Set<java.lang.String> getHeaders()
The Enumeration keys are Strings that represent the response-header field names.
public void reset()
public java.lang.String toString()
toString
in class java.lang.Object
public void list(java.io.PrintStream out)
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)