Class CaravanHttpRequest


  • @ProviderType
    public final class CaravanHttpRequest
    extends Object
    An immutable request to a HTTP server.
    • 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 use new 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
      • 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()