Package io.wcm.caravan.io.http.request
Class CaravanHttpRequest
- java.lang.Object
-
- io.wcm.caravan.io.http.request.CaravanHttpRequest
-
@ProviderType public final class CaravanHttpRequest extends Object
An immutable request to a HTTP server.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CORRELATION_ID_HEADER_NAME
Correlation ID Header name
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description byte[]
getBody()
If present, this is the replayable body to send to the server.Map<String,String>
getCacheControl()
Collects all "Cache-Control" directives from the response headers into a single map.Charset
getCharset()
The character set with which the body is encoded, or null if unknown or not applicable.String
getCorrelationId()
com.google.common.collect.Multimap<String,String>
getHeaders()
Ordered list of headers that will be sent to the server.String
getMethod()
Method to invoke on the server.io.wcm.caravan.common.performance.PerformanceMetrics
getPerformanceMetrics()
String
getServiceId()
String
getServiceName()
Deprecated.Please usegetServiceId()
String
getUrl()
Fully resolved url including query.boolean
hasParameter(String name)
String
toString()
-
-
-
Field Detail
-
CORRELATION_ID_HEADER_NAME
public static final String CORRELATION_ID_HEADER_NAME
Correlation ID Header name- See Also:
- Constant Field Values
-
-
Method Detail
-
getMethod
public String getMethod()
Method to invoke on the server.- Returns:
- HTTP method
-
getUrl
public String getUrl()
Fully resolved url including query.- Returns:
- URL
-
getHeaders
public com.google.common.collect.Multimap<String,String> getHeaders()
Ordered list of headers that will be sent to the server.- Returns:
- HTTP headers
-
getCacheControl
public Map<String,String> getCacheControl()
Collects all "Cache-Control" directives from the response headers into a single map. The keys in the map are the directive names (e.g. "max-age", "no-cache"), and everything after the "=" is taken as value. For directives that don't have a value "true" is used as a value instead.- Returns:
- the map of Cache-Control directives
-
hasParameter
public boolean hasParameter(String name)
- Parameters:
name
- of the query parameter- Returns:
- true if the parameter exists in this request's query
-
getCharset
public Charset getCharset()
The character set with which the body is encoded, or null if unknown or not applicable. When this is present, you can usenew String(req.body(), req.charset())
to access the body as a String.- Returns:
- Charset
-
getBody
public byte[] getBody()
If present, this is the replayable body to send to the server. In some cases, this may be interpretable as text.- Returns:
- HTTP body
- See Also:
getCharset()
-
getServiceId
public String getServiceId()
- Returns:
- the service ID
-
getServiceName
@Deprecated public String getServiceName()
Deprecated.Please usegetServiceId()
- Returns:
- the service ID
-
getCorrelationId
public String getCorrelationId()
- Returns:
- the value of the correlation-id header or null if it wasn't set
-
getPerformanceMetrics
public io.wcm.caravan.common.performance.PerformanceMetrics getPerformanceMetrics()
-
-