Class HttpExchange
java.lang.Object
org.springframework.boot.actuate.web.exchanges.HttpExchange
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Principal associated with an HTTP request-response exchange.static final class
The request that started the exchange.static final class
The response that finished the exchange.static final class
The session associated with the exchange.static final class
A started request that whenfinished
will return a newHttpExchange
instance. -
Constructor Summary
ConstructorsConstructorDescriptionHttpExchange
(Instant timestamp, HttpExchange.Request request, HttpExchange.Response response, @Nullable HttpExchange.Principal principal, @Nullable HttpExchange.Session session, @Nullable Duration timeTaken) Primarily for use byHttpExchangeRepository
implementations when recreating an exchange from a persistent store. -
Method Summary
Modifier and TypeMethodDescription@Nullable HttpExchange.Principal
Returns the principal.Returns the request that started the exchange.Returns the response that completed the exchange.@Nullable HttpExchange.Session
Returns the session details.Returns the instant that the exchange started.@Nullable Duration
Returns the total time taken for the exchange.static HttpExchange.Started
start
(Clock clock, RecordableHttpRequest request) Start a newHttpExchange.Started
from the given source request.static HttpExchange.Started
start
(RecordableHttpRequest request) Start a newHttpExchange.Started
from the given source request.
-
Constructor Details
-
HttpExchange
public HttpExchange(Instant timestamp, HttpExchange.Request request, HttpExchange.Response response, @Nullable HttpExchange.Principal principal, @Nullable HttpExchange.Session session, @Nullable Duration timeTaken) Primarily for use byHttpExchangeRepository
implementations when recreating an exchange from a persistent store.- Parameters:
timestamp
- the instant that the exchange startedrequest
- the requestresponse
- the responseprincipal
- the principalsession
- the sessiontimeTaken
- the total time taken
-
-
Method Details
-
getTimestamp
Returns the instant that the exchange started.- Returns:
- the start timestamp
-
getRequest
Returns the request that started the exchange.- Returns:
- the request.
-
getResponse
Returns the response that completed the exchange.- Returns:
- the response.
-
getPrincipal
-
getSession
Returns the session details.- Returns:
- the session
-
getTimeTaken
Returns the total time taken for the exchange.- Returns:
- the total time taken
-
start
Start a newHttpExchange.Started
from the given source request.- Parameters:
request
- the recordable HTTP request- Returns:
- an in-progress request
-
start
Start a newHttpExchange.Started
from the given source request.- Parameters:
clock
- the clock to userequest
- the recordable HTTP request- Returns:
- an in-progress request
-