Class HttpRequestImpl
java.lang.Object
org.apache.mina.http.HttpRequestImpl
- All Implemented Interfaces:
HttpMessage, HttpRequest
A HTTP Request implementation
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe set of headersprivate final HttpMethodThe HTTP methodprivate final StringThe query stringprivate final StringThe requested pathprivate final HttpVersionThe HTTP version -
Constructor Summary
ConstructorsConstructorDescriptionHttpRequestImpl(HttpVersion version, HttpMethod method, String requestedPath, String queryString, Map<String, String> headers) Creates a new HttpRequestImpl instance -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsHeader(String name) Tells if the message contains some headerbooleancontainsParameter(String name) Determines whether this request contains at least one parameter with the specified nameGets theContent-Typeheader of the message.Returns the value of the HTTP header with the specified name.Return the HTTP method used for this messageHttpMethodgetParameter(String name) Returns the value of a request parameter as a String, or null if the parameter does not exist.The HTTP version of the messageReturn the HTTP request pathbooleanprotected MatcherparameterPattern(String name) toString()
-
Field Details
-
version
The HTTP version -
method
The HTTP method -
requestedPath
The requested path -
queryString
The query string -
headers
-
-
Constructor Details
-
HttpRequestImpl
public HttpRequestImpl(HttpVersion version, HttpMethod method, String requestedPath, String queryString, Map<String, String> headers) Creates a new HttpRequestImpl instance- Parameters:
version- The HTTP versionmethod- The HTTP methodrequestedPath- The request pathqueryString- The query stringheaders- The headers
-
-
Method Details
-
getProtocolVersion
The HTTP version of the message- Specified by:
getProtocolVersionin interfaceHttpMessage- Returns:
- HTTP/1.0 or HTTP/1.1
-
getContentType
Gets theContent-Typeheader of the message.- Specified by:
getContentTypein interfaceHttpMessage- Returns:
- The content type.
-
isKeepAlive
public boolean isKeepAlive()- Specified by:
isKeepAlivein interfaceHttpMessage- Returns:
trueif this message enables keep-alive connection.
-
getHeader
Returns the value of the HTTP header with the specified name. If more than one header with the given name is associated with this request, one is selected and returned.- Specified by:
getHeaderin interfaceHttpMessage- Parameters:
name- The name of the desired header- Returns:
- The header value - or null if no header is found with the specified name
-
containsHeader
Tells if the message contains some header- Specified by:
containsHeaderin interfaceHttpMessage- Parameters:
name- the Header's name we are looking for- Returns:
trueif the HTTP header with the specified name exists in this request.
-
getHeaders
- Specified by:
getHeadersin interfaceHttpMessage- Returns:
- a read-only
Mapof HTTP headers whose key is aStringand whose value is aStrings.
-
containsParameter
Determines whether this request contains at least one parameter with the specified name- Specified by:
containsParameterin interfaceHttpRequest- Parameters:
name- The parameter name- Returns:
trueif this request contains at least one parameter with the specified name
-
getParameter
Returns the value of a request parameter as a String, or null if the parameter does not exist. If the request contained multiple parameters with the same name, this method returns the first parameter encountered in the request with the specified name- Specified by:
getParameterin interfaceHttpRequest- Parameters:
name- The parameter name- Returns:
- The value
-
parameterPattern
-
getParameters
- Specified by:
getParametersin interfaceHttpRequest- Returns:
- a read only
Mapof query parameters whose key is aStringand whose value is aListofStrings.
-
getQueryString
- Specified by:
getQueryStringin interfaceHttpRequest- Returns:
- The query part
-
getMethod
Return the HTTP method used for this messageHttpMethod- Specified by:
getMethodin interfaceHttpRequest- Returns:
- the method
-
getRequestPath
Return the HTTP request path- Specified by:
getRequestPathin interfaceHttpRequest- Returns:
- the request path
-
toString
-