Class HttpProxyRequest
- java.lang.Object
-
- org.apache.mina.proxy.handlers.ProxyRequest
-
- org.apache.mina.proxy.handlers.http.HttpProxyRequest
-
public class HttpProxyRequest extends ProxyRequest
HttpProxyRequest.java - Wrapper class for HTTP requests.- Since:
- MINA 2.0.0-M3
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.util.List<java.lang.String>>headersThe request headers.private java.lang.StringhostThe target hostname.private java.lang.StringhttpURIThe HTTP URI.private java.lang.StringhttpVerbThe HTTP verb.private java.lang.StringhttpVersionThe HTTP protocol version.private static org.slf4j.LoggerLOGGERprivate java.util.Map<java.lang.String,java.lang.String>propertiesThe additionnal properties supplied to use with the proxy for authentication for example.
-
Constructor Summary
Constructors Constructor Description HttpProxyRequest(java.lang.String httpURI)Constructor which creates a HTTP/1.0 GET request to the specified http URI.HttpProxyRequest(java.lang.String httpURI, java.lang.String httpVersion)Constructor which creates a GET request to the specified http URI using the provided protocol versionHttpProxyRequest(java.lang.String httpVerb, java.lang.String httpURI, java.lang.String httpVersion)Constructor which creates a request using the provided HTTP verb targeted at the specified http URI using the provided protocol version.HttpProxyRequest(java.lang.String httpVerb, java.lang.String httpURI, java.lang.String httpVersion, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)Constructor which creates a request using the provided HTTP verb targeted at the specified http URI using the provided protocol version and setting the requested headers.HttpProxyRequest(java.net.InetSocketAddress endpointAddress)Constructor which creates a HTTP/1.0 CONNECT request to the specified endpoint.HttpProxyRequest(java.net.InetSocketAddress endpointAddress, java.lang.String httpVersion)Constructor which creates a CONNECT request to the specified endpoint using the provided protocol version.HttpProxyRequest(java.net.InetSocketAddress endpointAddress, java.lang.String httpVersion, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)Constructor which creates a CONNECT request to the specified endpoint using the provided protocol version and setting the requested headers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckRequiredProperties(java.lang.String... propNames)Check if the given property(ies) is(are) set.java.util.Map<java.lang.String,java.util.List<java.lang.String>>getHeaders()java.lang.StringgetHost()java.lang.StringgetHttpURI()java.lang.StringgetHttpVerb()java.lang.StringgetHttpVersion()java.util.Map<java.lang.String,java.lang.String>getProperties()voidsetHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)Set the HTTP headers.voidsetHttpVersion(java.lang.String httpVersion)Sets the HTTP version.voidsetProperties(java.util.Map<java.lang.String,java.lang.String> properties)Set additional properties for the request.java.lang.StringtoHttpString()-
Methods inherited from class org.apache.mina.proxy.handlers.ProxyRequest
getEndpointAddress
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
httpVerb
private final java.lang.String httpVerb
The HTTP verb.
-
httpURI
private final java.lang.String httpURI
The HTTP URI.
-
httpVersion
private java.lang.String httpVersion
The HTTP protocol version.
-
host
private java.lang.String host
The target hostname.
-
headers
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers
The request headers.
-
properties
private java.util.Map<java.lang.String,java.lang.String> properties
The additionnal properties supplied to use with the proxy for authentication for example.
-
-
Constructor Detail
-
HttpProxyRequest
public HttpProxyRequest(java.net.InetSocketAddress endpointAddress)
Constructor which creates a HTTP/1.0 CONNECT request to the specified endpoint.- Parameters:
endpointAddress- the endpoint to connect to
-
HttpProxyRequest
public HttpProxyRequest(java.net.InetSocketAddress endpointAddress, java.lang.String httpVersion)Constructor which creates a CONNECT request to the specified endpoint using the provided protocol version.- Parameters:
endpointAddress- the endpoint to connect tohttpVersion- the HTTP protocol version
-
HttpProxyRequest
public HttpProxyRequest(java.net.InetSocketAddress endpointAddress, java.lang.String httpVersion, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)Constructor which creates a CONNECT request to the specified endpoint using the provided protocol version and setting the requested headers.- Parameters:
endpointAddress- the endpoint to connect tohttpVersion- the HTTP protocol versionheaders- the additionnal http headers
-
HttpProxyRequest
public HttpProxyRequest(java.lang.String httpURI)
Constructor which creates a HTTP/1.0 GET request to the specified http URI.- Parameters:
httpURI- the target URI
-
HttpProxyRequest
public HttpProxyRequest(java.lang.String httpURI, java.lang.String httpVersion)Constructor which creates a GET request to the specified http URI using the provided protocol version- Parameters:
httpURI- the target URIhttpVersion- the HTTP protocol version
-
HttpProxyRequest
public HttpProxyRequest(java.lang.String httpVerb, java.lang.String httpURI, java.lang.String httpVersion)Constructor which creates a request using the provided HTTP verb targeted at the specified http URI using the provided protocol version.- Parameters:
httpVerb- the HTTP verb to usehttpURI- the target URIhttpVersion- the HTTP protocol version
-
HttpProxyRequest
public HttpProxyRequest(java.lang.String httpVerb, java.lang.String httpURI, java.lang.String httpVersion, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)Constructor which creates a request using the provided HTTP verb targeted at the specified http URI using the provided protocol version and setting the requested headers.- Parameters:
httpVerb- the HTTP verb to usehttpURI- the target URIhttpVersion- the HTTP protocol versionheaders- the additional http headers
-
-
Method Detail
-
getHttpVerb
public final java.lang.String getHttpVerb()
- Returns:
- the HTTP request verb.
-
getHttpVersion
public java.lang.String getHttpVersion()
- Returns:
- the HTTP version.
-
setHttpVersion
public void setHttpVersion(java.lang.String httpVersion)
Sets the HTTP version.- Parameters:
httpVersion- the HTTP protocol version
-
getHost
public final java.lang.String getHost()
- Returns:
- the host to which we are connecting.
-
getHttpURI
public final java.lang.String getHttpURI()
- Returns:
- the request HTTP URI.
-
getHeaders
public final java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
- Returns:
- the HTTP headers.
-
setHeaders
public final void setHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
Set the HTTP headers.- Parameters:
headers- The HTTP headers to set
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()
- Returns:
- additional properties for the request.
-
setProperties
public void setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Set additional properties for the request.- Parameters:
properties- The properties to add to the reqyest
-
checkRequiredProperties
public void checkRequiredProperties(java.lang.String... propNames) throws ProxyAuthExceptionCheck if the given property(ies) is(are) set. Otherwise throws aProxyAuthException.- Parameters:
propNames- The list of property name to check- Throws:
ProxyAuthException- If we get an error during the proxy authentication
-
toHttpString
public java.lang.String toHttpString()
- Returns:
- the string representation of the HTTP request .
-
-