java.lang.Object
org.springframework.boot.actuate.web.exchanges.HttpExchange

public final class HttpExchange extends Object
An HTTP request and response exchange. Can be used for analyzing contextual information such as HTTP headers. Data from this class will be exposed by the HttpExchangesEndpoint, usually as JSON.
Since:
3.0.0
Author:
Dave Syer, Andy Wilkinson, Phillip Webb
  • Constructor Details

  • Method Details

    • getTimestamp

      public Instant getTimestamp()
      Returns the instant that the exchange started.
      Returns:
      the start timestamp
    • getRequest

      public HttpExchange.Request getRequest()
      Returns the request that started the exchange.
      Returns:
      the request.
    • getResponse

      public HttpExchange.Response getResponse()
      Returns the response that completed the exchange.
      Returns:
      the response.
    • getPrincipal

      public HttpExchange.Principal getPrincipal()
      Returns the principal.
      Returns:
      the request
    • getSession

      public HttpExchange.Session getSession()
      Returns the session details.
      Returns:
      the session
    • getTimeTaken

      public Duration getTimeTaken()
      Returns the total time taken for the exchange.
      Returns:
      the total time taken
    • start

      public static HttpExchange.Started start(RecordableHttpRequest request)
      Start a new HttpExchange.Started from the given source request.
      Parameters:
      request - the recordable HTTP request
      Returns:
      an in-progress request
    • start

      public static HttpExchange.Started start(Clock clock, RecordableHttpRequest request)
      Start a new HttpExchange.Started from the given source request.
      Parameters:
      clock - the clock to use
      request - the recordable HTTP request
      Returns:
      an in-progress request