Class HttpRequestHeaderInterceptor
java.lang.Object
org.springframework.graphql.server.support.HttpRequestHeaderInterceptor
- All Implemented Interfaces:
WebGraphQlInterceptor
Interceptor that copies HTTP request headers to the GraphQL context to make
them available to data fetchers such as annotated controllers, which can use
@ContextValue
method parameters to access the headers as context values.
User builder()
to build an instance, and specify headers of
interest that should be copied to the GraphQL context.
- Since:
- 2.0.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.springframework.graphql.server.WebGraphQlInterceptor
WebGraphQlInterceptor.Chain
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Return a builder to create anHttpRequestHeaderInterceptor
.reactor.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
-
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
-
builder
Return a builder to create anHttpRequestHeaderInterceptor
.
-