Rename [Web|Socket]Interceptor
Use more qualified names [Web|Socket]GraphQlHandlerInterceptor to differentiate with ClientGraphQlInterceptor and to align with other types in the same package.
This commit is contained in:
@@ -118,19 +118,19 @@ The Spring for GraphQL repository contains a WebFlux
|
||||
|
||||
<<web-http>> and <<web-websocket>> transport handlers delegate to a common Web
|
||||
interception chain for request execution. The chain consists of a sequence of
|
||||
`WebInterceptor` components, followed by a `ExecutionGraphQlService` that invokes
|
||||
GraphQL Java.
|
||||
`WebGraphQlHandlerInterceptor` components, followed by a `ExecutionGraphQlService` that
|
||||
invokes GraphQL Java.
|
||||
|
||||
`WebInterceptor` is as a common contract to use in both Spring MVC and WebFlux
|
||||
applications. Use it to intercept requests, inspect HTTP request headers, or to register a
|
||||
transformation of the `graphql.ExecutionInput`:
|
||||
`WebGraphQlHandlerInterceptor` is as a common contract to use in both Spring MVC and
|
||||
WebFlux applications. Use it to intercept requests, inspect HTTP request headers, or to
|
||||
register a transformation of the `graphql.ExecutionInput`:
|
||||
|
||||
[source,java,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
class MyInterceptor implements WebInterceptor {
|
||||
class MyInterceptor implements WebGraphQlHandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, WebInterceptorChain chain) {
|
||||
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {
|
||||
request.configureExecutionInput((executionInput, builder) -> {
|
||||
Map<String, Object> map = ... ;
|
||||
return builder.extensions(map).build();
|
||||
@@ -140,15 +140,15 @@ class MyInterceptor implements WebInterceptor {
|
||||
}
|
||||
----
|
||||
|
||||
Use `WebInterceptor` also to intercept responses, add HTTP response headers, or transform
|
||||
the `graphql.ExecutionResult`:
|
||||
Use `WebGraphQlHandlerInterceptor` also to intercept responses, add HTTP response headers,
|
||||
or transform the `graphql.ExecutionResult`:
|
||||
|
||||
[source,java,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
class MyInterceptor implements WebInterceptor {
|
||||
class MyInterceptor implements WebGraphQlHandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, WebInterceptorChain chain) {
|
||||
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {
|
||||
return chain.next(request)
|
||||
.map(response -> {
|
||||
Object data = response.getData();
|
||||
@@ -423,7 +423,8 @@ thread and Reactor `Context` from the WebFlux processing pipeline.
|
||||
|
||||
A `DataFetcher` and other components invoked by GraphQL Java may not always execute on
|
||||
the same thread as the Spring MVC handler, for example if an asynchronous
|
||||
<<web-interception, `WebInterceptor`>> or `DataFetcher` switches to a different thread.
|
||||
<<web-interception, `WebGraphQlHandlerInterceptor`>> or `DataFetcher` switches to a
|
||||
different thread.
|
||||
|
||||
Spring for GraphQL supports propagating `ThreadLocal` values from the Servlet container
|
||||
thread to the thread a `DataFetcher` and other components invoked by GraphQL Java to
|
||||
@@ -467,7 +468,7 @@ Spring MVC application, see the
|
||||
|
||||
A <<execution-reactive-datafetcher>> can rely on access to Reactor context that
|
||||
originates from the WebFlux request handling chain. This includes Reactor context
|
||||
added by <<web-interception, WebInterceptor>> components.
|
||||
added by <<web-interception, WebGraphQlHandlerInterceptor>> components.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -197,7 +197,8 @@ a client. However, in some cases it's useful to involve server side transport
|
||||
handling with given mock transport input.
|
||||
|
||||
The `WebGraphQlHandlerTester` extension lets you processes request through the
|
||||
`WebInterceptor` chain before handing off to `ExecutionGraphQlService` for request execution:
|
||||
`WebGraphQlHandlerInterceptor` chain before handing off to `ExecutionGraphQlService` for
|
||||
request execution:
|
||||
|
||||
[source,java,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user