public class BasicHttpRequest extends HeaderGroup implements HttpRequest
HttpRequest.| Constructor and Description |
|---|
BasicHttpRequest(Method method,
HttpHost host,
String path)
Creates request message with the given method, host and request path.
|
BasicHttpRequest(Method method,
String path)
Creates request message with the given method and request path.
|
BasicHttpRequest(Method method,
URI requestUri)
Creates request message with the given method, request URI.
|
BasicHttpRequest(String method,
HttpHost host,
String path)
Creates request message with the given method, host and request path.
|
BasicHttpRequest(String method,
String path)
Creates request message with the given method and request path.
|
BasicHttpRequest(String method,
String scheme,
URIAuthority authority,
String path)
Creates request message with the given method, host and request path.
|
BasicHttpRequest(String method,
URI requestUri)
Creates request message with the given method, request URI.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(String name,
Object value)
Adds a header to this message.
|
URIAuthority |
getAuthority()
Returns authority of this request message.
|
String |
getMethod()
Returns method of this request message.
|
String |
getPath()
Returns URI path of this request message or
null if not set. |
String |
getRequestUri()
Returns request URI of this request message.
|
String |
getScheme()
Returns scheme of this request message.
|
URI |
getUri()
Returns full request URI of this request message.
|
ProtocolVersion |
getVersion()
Returns protocol version or
null when not available. |
void |
setAbsoluteRequestUri(boolean absoluteRequestUri)
Sets a flag that the
getRequestUri() method should return the request URI
in an absolute form. |
void |
setAuthority(URIAuthority authority)
Sets authority of this request message.
|
void |
setHeader(String name,
Object value)
Overwrites the first header with the same name.
|
void |
setPath(String path)
Sets URI path of this request message.
|
void |
setScheme(String scheme)
Sets scheme of this request message.
|
void |
setUri(URI requestUri)
Sets the full request URI of this request message.
|
void |
setVersion(ProtocolVersion version)
Sets protocol version.
|
String |
toString() |
addHeader, clear, containsHeader, countHeaders, getCondensedHeader, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, removeHeaders, setHeader, setHeadersclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddHeader, removeHeader, removeHeaders, setHeader, setHeaderscontainsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIteratorpublic BasicHttpRequest(String method, String scheme, URIAuthority authority, String path)
method - request method.scheme - request scheme.authority - request authority.path - request path.public BasicHttpRequest(String method, String path)
method - request method.path - request path.public BasicHttpRequest(String method, HttpHost host, String path)
method - request method.host - request host.path - request path.public BasicHttpRequest(String method, URI requestUri)
method - request method.requestUri - request URI.public BasicHttpRequest(Method method, String path)
method - request method.path - request path.public BasicHttpRequest(Method method, HttpHost host, String path)
method - request method.host - request host.path - request path.public void addHeader(String name, Object value)
HttpMessageaddHeader in interface HttpMessagename - the name of the header.value - the value of the header, taken as the value's Object.toString().public void setHeader(String name, Object value)
HttpMessagesetHeader in interface HttpMessagename - the name of the header.value - the value of the header, taken as the value's Object.toString().public void setVersion(ProtocolVersion version)
HttpMessageFor incoming messages it represents protocol version this message was transmitted with. For outgoing messages it represents a hint what protocol version should be used to transmit the message.
setVersion in interface HttpMessagepublic ProtocolVersion getVersion()
HttpMessagenull when not available.
For incoming messages it represents protocol version this message was transmitted with. For outgoing messages it represents a hint what protocol version should be used to transmit the message.
getVersion in interface HttpMessagepublic String getMethod()
HttpRequestgetMethod in interface HttpRequestpublic String getPath()
HttpRequestnull if not set.getPath in interface HttpRequestnull.public void setPath(String path)
HttpRequestsetPath in interface HttpRequestpublic String getScheme()
HttpRequestgetScheme in interface HttpRequestnull.public void setScheme(String scheme)
HttpRequestsetScheme in interface HttpRequestpublic URIAuthority getAuthority()
HttpRequestgetAuthority in interface HttpRequestnull.public void setAuthority(URIAuthority authority)
HttpRequestsetAuthority in interface HttpRequestpublic void setAbsoluteRequestUri(boolean absoluteRequestUri)
getRequestUri() method should return the request URI
in an absolute form.
This flag can used when the request is going to be transmitted via an HTTP/1.1 proxy.
public String getRequestUri()
HttpRequestgetRequestUri in interface HttpRequestpublic void setUri(URI requestUri)
HttpRequestsetUri in interface HttpRequestrequestUri - the request URI.public URI getUri() throws URISyntaxException
HttpRequestgetUri in interface HttpRequestURISyntaxExceptionpublic String toString()
toString in class HeaderGroupCopyright © 2005–2022 The Apache Software Foundation. All rights reserved.