public class HttpRequestImpl extends Object implements HttpRequest
| Constructor and Description |
|---|
HttpRequestImpl()
Creates a new unintialized instance.
|
HttpRequestImpl(HttpRequest request)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
HttpRequestImpl |
content(byte[] content)
Sets content of message body for request.
|
HttpRequestImpl |
contentMatcher(ContentMatcher matcher)
Sets
ContentMatcher. |
boolean |
equals(Object obj) |
byte[] |
getContent()
Get content for request.
|
Set<HttpMessageHeader> |
getHttpMessageHeaders()
Get http message headers.
|
Set<HttpMessageHeader> |
getHttpMessageHeaders(String name)
Get http message headers with given name/key.
|
Method |
getMethod()
Gets method for request.
|
String |
getPath()
Gets path for request without query parameters.
|
Set<QueryParameter> |
getQueryParameters()
Gets query parameters for request.
|
Set<QueryParameter> |
getQueryParameters(String key)
Gets query parameters with given key.
|
int |
hashCode() |
HttpRequestImpl |
httpMessageHeader(String name,
String value)
Adds a Http message header.
|
HttpRequestImpl |
method(Method method)
Sets method for request.
|
HttpRequestImpl |
path(String path)
Sets path for request.
|
HttpRequestImpl |
queryParameter(String key,
String value)
Adds a query parameter for request.
|
HttpRequestImpl |
removeHttpMessageHeader(String name,
String value)
Removes Http message header with given name and value.
|
HttpRequestImpl |
removeHttpMessageHeaders(String name)
Removes all Http message headers with given name.
|
HttpRequestImpl |
removeQueryParameter(String key,
String value)
Removes Query Parameter with given key and value.
|
HttpRequestImpl |
removeQueryParameters(String key)
Removes all Query Parameters that have given key.
|
String |
toString() |
public HttpRequestImpl()
public HttpRequestImpl(HttpRequest request)
request - Request to copy.public HttpRequestImpl method(Method method)
method - Method for request.public HttpRequestImpl content(byte[] content)
content - Message body for request.public HttpRequestImpl contentMatcher(ContentMatcher matcher) throws UnexpectedContentException
ContentMatcher. It will be initialized with any existing data.
If not set a default ContentMatcher will be used which simply does an equals on byte array.matcher - New Content matcher. Should not be null.UnexpectedContentException - In case the current content is incompatible with the new ContentMatcher. In this
case the new matcher will not be set. The previous ContentMatcher will remain active.public HttpRequestImpl path(String path)
path - Sets path for request.public HttpRequestImpl queryParameter(String key, String value)
key - Parameter key. Should not be empty or null or blank.value - Parameter value. Should not be empty or null or blank.public HttpRequestImpl removeQueryParameter(String key, String value)
key - Query parameter key.value - Query parameter value.public HttpRequestImpl removeQueryParameters(String key)
key - Query parameter key.public HttpRequestImpl httpMessageHeader(String name, String value)
name - header name. Should not be null or blank.value - header value. Should not be null or blank.public HttpRequestImpl removeHttpMessageHeader(String name, String value)
name - Http message header name.value - Http message header value.public HttpRequestImpl removeHttpMessageHeaders(String name)
name - Http message header name.public Method getMethod()
getMethod in interface HttpRequestpublic byte[] getContent()
getContent in interface HttpRequestpublic String getPath()
getPath in interface HttpRequestpublic Set<QueryParameter> getQueryParameters()
getQueryParameters in interface HttpRequestpublic Set<HttpMessageHeader> getHttpMessageHeaders()
getHttpMessageHeaders in interface HttpRequestpublic Set<QueryParameter> getQueryParameters(String key)
getQueryParameters in interface HttpRequestkey - Query parameter key. Should not be null or blank.public Set<HttpMessageHeader> getHttpMessageHeaders(String name)
getHttpMessageHeaders in interface HttpRequestname - Name/key. Should not be null or blank.Copyright © 2014. All Rights Reserved.