B - the type of the builder itself.M - the type of HttpMessage that the builder creates.public abstract class HttpMessageBuilder<B extends HttpMessageBuilder,M extends HttpMessage> extends Object
HttpMessage builder. Implementations should extend it and indicate their type and the type of
the message they build.| Modifier and Type | Field and Description |
|---|---|
protected HttpEntity |
entity |
protected org.mule.runtime.api.util.MultiMap<String,String> |
headers |
| Constructor and Description |
|---|
HttpMessageBuilder() |
| Modifier and Type | Method and Description |
|---|---|
B |
addHeader(String name,
String value)
Includes a new header to be sent in the desired
HttpMessage. |
abstract M |
build() |
B |
entity(HttpEntity entity) |
org.mule.runtime.api.util.MultiMap<String,String> |
getHeaders() |
Optional<String> |
getHeaderValue(String name)
Returns the value of a given HTTP request.
|
Collection<String> |
getHeaderValues(String name)
Gives access to all current values of a given HTTP header.
|
B |
headers(org.mule.runtime.api.util.MultiMap<String,String> headersMap) |
B |
removeHeader(String name)
Removes a header.
|
protected HttpEntity entity
public B entity(HttpEntity entity)
entity - the HttpEntity that should be used as body for the HttpMessage. Non null.public B headers(org.mule.runtime.api.util.MultiMap<String,String> headersMap)
headersMap - a MultiMap representing the HTTP headers of the HttpRequest desired. Non null.public B addHeader(String name, String value)
HttpMessage. Since HTTP headers are case insensitive and can have
several values, multiple calls to this method using the same header name will accumulate the values and all of them will be sent.name - the name of the HTTP headervalue - the value of the HTTP headerpublic B removeHeader(String name)
name - the name of the HTTP header to removepublic Optional<String> getHeaderValue(String name)
getHeaderValues(String) instead if all values are required.name - the name of the desired HTTP headernull if there isn't onepublic Collection<String> getHeaderValues(String name)
name - the name of the desired HTTP headerCollection of String values for the headerpublic org.mule.runtime.api.util.MultiMap<String,String> getHeaders()
public abstract M build()
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.