mx4j.tools.adaptor.http
Class HttpInputStream
BufferedInputStream
mx4j.tools.adaptor.http.HttpInputStream
public class HttpInputStream
extends BufferedInputStream
HttpInputStream processes an HTTP request
Version:
String | getHeader(String name) - Returns a given header by name, assumes lower case
|
Map | getHeaders() - Returns a given header by name, assumes lower case
|
String | getMethod() - Returns the method of the request
|
String | getPath() - Returns the path of the request
|
String | getQueryString() - Returns the query string
|
String | getVariable(String name) - Returns one variable value.
|
String[] | getVariableValues(String name) - Returns one variable values.
|
Map | getVariables() - Returns a map with the variables passed in the request.
|
float | getVersion() - Returns the version of the request
|
protected void | parseMethod(String method) - Parses the connection method.
|
protected void | parseRequest(String request) - Parses the request
|
protected void | parseVariables() - Parses the request parameters
|
protected void | parseVersion(String verStr) - Parses the request HttpConstants version
|
protected void | readHeaders() - Reads the headers
|
String | readLine() - Reads an HTTP line
|
void | readRequest() - Reads the request parsing the headers
|
HttpInputStream
public HttpInputStream(InputStream in)
Constructs a new HttpInputStream
in
- InputStream
getHeader
public String getHeader(String name)
Returns a given header by name, assumes lower case
name
- Name of the header
- The header value
getHeaders
public Map getHeaders()
Returns a given header by name, assumes lower case
- The header value
getMethod
public String getMethod()
Returns the method of the request
- the method of the request GET/POST
getPath
public String getPath()
Returns the path of the request
- the path of the request
getQueryString
public String getQueryString()
Returns the query string
- The queryString value
getVariable
public String getVariable(String name)
Returns one variable value. If the variable is present many times, the first
instance will be returned
- A String with the variable value
getVariableValues
public String[] getVariableValues(String name)
Returns one variable values.
- A String array with all variable instances
getVariables
public Map getVariables()
Returns a map with the variables passed in the request.
- A map containing variables/value pairs. If a variable is
present only once in the request the value will be a String.
If it is present many times the variable will be a String[]
getVersion
public float getVersion()
Returns the version of the request
- The version value 1.0/1.1
parseMethod
protected void parseMethod(String method)
throws HttpException
Parses the connection method. GET/POST are allowed
method
- Description of Parameter
HttpException
- Description of Exception
parseRequest
protected void parseRequest(String request)
throws HttpException
Parses the request
request
- Request string
HttpException
- Thrown if an error ocurr
parseVariables
protected void parseVariables()
throws HttpException
Parses the request parameters
parseVersion
protected void parseVersion(String verStr)
throws HttpException
Parses the request HttpConstants version
verStr
- String containing the HTTP version
HttpException
-
readHeaders
protected void readHeaders()
throws IOException
Reads the headers
readLine
public String readLine()
throws IOException
Reads an HTTP line
- A read line
readRequest
public void readRequest()
throws IOException
Reads the request parsing the headers
Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.