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 classPrincipal associated with an HTTP request-response exchange.static final classThe request that started the exchange.static final classThe response that finished the exchange.static final classThe session associated with the exchange.static final classA started request that whenfinishedwill return a newHttpExchangeinstance. -
Constructor Summary
ConstructorsConstructorDescriptionHttpExchange(Instant timestamp, HttpExchange.Request request, HttpExchange.Response response, HttpExchange.Principal principal, HttpExchange.Session session, Duration timeTaken) Primarily for use byHttpExchangeRepositoryimplementations when recreating an exchange from a persistent store. -
Method Summary
Modifier and TypeMethodDescriptionReturns the principal.Returns the request that started the exchange.Returns the response that completed the exchange.Returns the session details.Returns the instant that the exchange started.Returns the total time taken for the exchange.static HttpExchange.Startedstart(Clock clock, RecordableHttpRequest request) Start a newHttpExchange.Startedfrom the given source request.static HttpExchange.Startedstart(RecordableHttpRequest request) Start a newHttpExchange.Startedfrom the given source request.
-
Constructor Details
-
HttpExchange
public HttpExchange(Instant timestamp, HttpExchange.Request request, HttpExchange.Response response, HttpExchange.Principal principal, HttpExchange.Session session, Duration timeTaken) Primarily for use byHttpExchangeRepositoryimplementations 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
Returns the principal.- Returns:
- the request
-
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.Startedfrom the given source request.- Parameters:
request- the recordable HTTP request- Returns:
- an in-progress request
-
start
Start a newHttpExchange.Startedfrom the given source request.- Parameters:
clock- the clock to userequest- the recordable HTTP request- Returns:
- an in-progress request
-