Class TimeoutWebGraphQlInterceptor
java.lang.Object
org.springframework.graphql.server.TimeoutWebGraphQlInterceptor
- All Implemented Interfaces:
WebGraphQlInterceptor
Web interceptor
that enforces a request timeout
for GraphQL requests. By default, timeouts will result in
HttpStatus.REQUEST_TIMEOUT
responses.
For streaming responses (like subscriptions), this timeout is only enforced until the response stream is established. Transport-specific timeouts are configurable on the transport handlers directly.
- Since:
- 1.4
- Author:
- Brian Clozel
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.graphql.server.WebGraphQlInterceptor
WebGraphQlInterceptor.Chain
-
Constructor Summary
ConstructorsConstructorDescriptionTimeoutWebGraphQlInterceptor
(Duration timeout) Create a new interceptor for the given timeout duration.TimeoutWebGraphQlInterceptor
(Duration timeout, HttpStatus timeoutStatus) Create a new interceptor for the given timeout duration and response status. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<WebGraphQlResponse>
intercept
(WebGraphQlRequest request, WebGraphQlInterceptor.Chain chain) Intercept a request and delegate to the rest of the chain including other interceptors and aExecutionGraphQlService
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.graphql.server.WebGraphQlInterceptor
andThen, apply
-
Constructor Details
-
TimeoutWebGraphQlInterceptor
Create a new interceptor for the given timeout duration.- Parameters:
timeout
- the request timeout to enforce
-
TimeoutWebGraphQlInterceptor
Create a new interceptor for the given timeout duration and response status.- Parameters:
timeout
- the request timeout to enforcetimeoutStatus
- the HTTP response status to use in case of timeouts
-
-
Method Details
-
intercept
public reactor.core.publisher.Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, WebGraphQlInterceptor.Chain chain) Description copied from interface:WebGraphQlInterceptor
Intercept a request and delegate to the rest of the chain including other interceptors and aExecutionGraphQlService
.- Specified by:
intercept
in interfaceWebGraphQlInterceptor
- Parameters:
request
- the request which may be aWebSocketGraphQlRequest
when intercepting a GraphQL request over WebSocketchain
- the rest of the chain to execute the request- Returns:
- a
Mono
with the response
-