Skip to content

Commit 6584b88

Browse files
committed
Shorten names of [Web|RSocket]GraphQlHandlerInterceptor
See gh-339
1 parent 36425af commit 6584b88

File tree

21 files changed

+69
-69
lines changed

21 files changed

+69
-69
lines changed

spring-graphql-docs/src/docs/asciidoc/index.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,16 @@ The Spring for GraphQL repository contains a WebFlux
118118

119119
<<web-http>> and <<web-websocket>> transport handlers delegate to a common Web
120120
interception chain for request execution. The chain consists of a sequence of
121-
`WebGraphQlHandlerInterceptor` components, followed by a `ExecutionGraphQlService` that
121+
`WebGraphQlInterceptor` components, followed by a `ExecutionGraphQlService` that
122122
invokes GraphQL Java.
123123

124-
`WebGraphQlHandlerInterceptor` is as a common contract to use in both Spring MVC and
124+
`WebGraphQlInterceptor` is as a common contract to use in both Spring MVC and
125125
WebFlux applications. Use it to intercept requests, inspect HTTP request headers, or to
126126
register a transformation of the `graphql.ExecutionInput`:
127127

128128
[source,java,indent=0,subs="verbatim,quotes"]
129129
----
130-
class MyInterceptor implements WebGraphQlHandlerInterceptor {
130+
class MyInterceptor implements WebGraphQlInterceptor {
131131
132132
@Override
133133
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {
@@ -140,12 +140,12 @@ class MyInterceptor implements WebGraphQlHandlerInterceptor {
140140
}
141141
----
142142

143-
Use `WebGraphQlHandlerInterceptor` also to intercept responses, add HTTP response headers,
143+
Use `WebGraphQlInterceptor` also to intercept responses, add HTTP response headers,
144144
or transform the `graphql.ExecutionResult`:
145145

146146
[source,java,indent=0,subs="verbatim,quotes"]
147147
----
148-
class MyInterceptor implements WebGraphQlHandlerInterceptor {
148+
class MyInterceptor implements WebGraphQlInterceptor {
149149
150150
@Override
151151
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {
@@ -423,7 +423,7 @@ thread and Reactor `Context` from the WebFlux processing pipeline.
423423

424424
A `DataFetcher` and other components invoked by GraphQL Java may not always execute on
425425
the same thread as the Spring MVC handler, for example if an asynchronous
426-
<<web-interception, `WebGraphQlHandlerInterceptor`>> or `DataFetcher` switches to a
426+
<<web-interception, `WebGraphQlInterceptor`>> or `DataFetcher` switches to a
427427
different thread.
428428

429429
Spring for GraphQL supports propagating `ThreadLocal` values from the Servlet container
@@ -468,7 +468,7 @@ Spring MVC application, see the
468468

469469
A <<execution-reactive-datafetcher>> can rely on access to Reactor context that
470470
originates from the WebFlux request handling chain. This includes Reactor context
471-
added by <<web-interception, WebGraphQlHandlerInterceptor>> components.
471+
added by <<web-interception, WebGraphQlInterceptor>> components.
472472

473473

474474

spring-graphql-docs/src/docs/asciidoc/testing.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ a client. However, in some cases it's useful to involve server side transport
197197
handling with given mock transport input.
198198

199199
The `WebGraphQlHandlerTester` extension lets you processes request through the
200-
`WebGraphQlHandlerInterceptor` chain before handing off to `ExecutionGraphQlService` for
200+
`WebGraphQlInterceptor` chain before handing off to `ExecutionGraphQlService` for
201201
request execution:
202202

203203
[source,java,indent=0,subs="verbatim,quotes"]

spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/WebGraphQlTester.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* Server-side tester, without a client, that executes requests through a
2828
* {@link WebGraphQlHandler}. Similar to {@link GraphQlServiceTester} but also
29-
* adding a web processing layer with a {@code WebGraphQlHandlerInterceptor}
29+
* adding a web processing layer with a {@code WebGraphQlInterceptor}
3030
* chain.
3131
*
3232
* @author Rossen Stoyanchev

spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/WebGraphQlTesterBuilderTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import org.springframework.graphql.web.TestWebSocketClient;
4242
import org.springframework.graphql.web.TestWebSocketConnection;
4343
import org.springframework.graphql.web.WebGraphQlHandler;
44-
import org.springframework.graphql.web.WebGraphQlHandlerInterceptor;
44+
import org.springframework.graphql.web.WebGraphQlInterceptor;
4545
import org.springframework.graphql.web.webflux.GraphQlHttpHandler;
4646
import org.springframework.graphql.web.webflux.GraphQlWebSocketHandler;
4747
import org.springframework.http.codec.ClientCodecConfigurer;
@@ -60,7 +60,7 @@
6060

6161
/**
6262
* Tests for the builders of Web {@code GraphQlTester} extensions, using a
63-
* {@link WebGraphQlHandlerInterceptor} to capture the WebGraphQlRequest on the
63+
* {@link WebGraphQlInterceptor} to capture the WebGraphQlRequest on the
6464
* server side, and optionally returning a mock response, or an empty response.
6565
*
6666
* <ul>

spring-graphql/src/main/java/org/springframework/graphql/web/DefaultWebGraphQlHandlerBuilder.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.springframework.graphql.ExecutionGraphQlService;
2626
import org.springframework.graphql.execution.ReactorContextManager;
2727
import org.springframework.graphql.execution.ThreadLocalAccessor;
28-
import org.springframework.graphql.web.WebGraphQlHandlerInterceptor.Chain;
28+
import org.springframework.graphql.web.WebGraphQlInterceptor.Chain;
2929
import org.springframework.lang.Nullable;
3030
import org.springframework.util.Assert;
3131
import org.springframework.util.CollectionUtils;
@@ -40,10 +40,10 @@ class DefaultWebGraphQlHandlerBuilder implements WebGraphQlHandler.Builder {
4040

4141
private final ExecutionGraphQlService service;
4242

43-
private final List<WebGraphQlHandlerInterceptor> interceptors = new ArrayList<>();
43+
private final List<WebGraphQlInterceptor> interceptors = new ArrayList<>();
4444

4545
@Nullable
46-
private WebSocketGraphQlHandlerInterceptor webSocketInterceptor;
46+
private WebSocketGraphQlInterceptor webSocketInterceptor;
4747

4848
@Nullable
4949
private List<ThreadLocalAccessor> accessors;
@@ -56,17 +56,17 @@ class DefaultWebGraphQlHandlerBuilder implements WebGraphQlHandler.Builder {
5656

5757

5858
@Override
59-
public WebGraphQlHandler.Builder interceptor(WebGraphQlHandlerInterceptor... interceptors) {
59+
public WebGraphQlHandler.Builder interceptor(WebGraphQlInterceptor... interceptors) {
6060
return interceptors(Arrays.asList(interceptors));
6161
}
6262

6363
@Override
64-
public WebGraphQlHandler.Builder interceptors(List<WebGraphQlHandlerInterceptor> interceptors) {
64+
public WebGraphQlHandler.Builder interceptors(List<WebGraphQlInterceptor> interceptors) {
6565
this.interceptors.addAll(interceptors);
6666
interceptors.forEach(interceptor -> {
67-
if (interceptor instanceof WebSocketGraphQlHandlerInterceptor) {
67+
if (interceptor instanceof WebSocketGraphQlInterceptor) {
6868
Assert.isNull(this.webSocketInterceptor, "There can be at most 1 WebSocketInterceptor");
69-
this.webSocketInterceptor = (WebSocketGraphQlHandlerInterceptor) interceptor;
69+
this.webSocketInterceptor = (WebSocketGraphQlInterceptor) interceptor;
7070
}
7171
});
7272
return this;
@@ -92,7 +92,7 @@ public WebGraphQlHandler build() {
9292
Chain endOfChain = request -> this.service.execute(request).map(WebGraphQlResponse::new);
9393

9494
Chain chain = this.interceptors.stream()
95-
.reduce(WebGraphQlHandlerInterceptor::andThen)
95+
.reduce(WebGraphQlInterceptor::andThen)
9696
.map(interceptor -> (Chain) (request) -> interceptor.intercept(request, endOfChain))
9797
.orElse(endOfChain);
9898

@@ -111,9 +111,9 @@ public Mono<WebGraphQlResponse> handleRequest(WebGraphQlRequest request) {
111111
}
112112

113113
@Override
114-
public WebSocketGraphQlHandlerInterceptor webSocketInterceptor() {
114+
public WebSocketGraphQlInterceptor webSocketInterceptor() {
115115
return (webSocketInterceptor != null ?
116-
webSocketInterceptor : new WebSocketGraphQlHandlerInterceptor() {});
116+
webSocketInterceptor : new WebSocketGraphQlInterceptor() {});
117117
}
118118

119119
};

spring-graphql/src/main/java/org/springframework/graphql/web/GraphQlRSocketHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
import org.springframework.graphql.ExecutionGraphQlResponse;
3030
import org.springframework.graphql.ExecutionGraphQlService;
31-
import org.springframework.graphql.web.RSocketGraphQlHandlerInterceptor.Chain;
31+
import org.springframework.graphql.web.RSocketGraphQlInterceptor.Chain;
3232
import org.springframework.util.AlternativeJdkIdGenerator;
3333
import org.springframework.util.IdGenerator;
3434

@@ -78,13 +78,13 @@ public class GraphQlRSocketHandler {
7878
* followed by the given {@link ExecutionGraphQlService}.
7979
*/
8080
public GraphQlRSocketHandler(
81-
ExecutionGraphQlService service, List<RSocketGraphQlHandlerInterceptor> interceptors) {
81+
ExecutionGraphQlService service, List<RSocketGraphQlInterceptor> interceptors) {
8282

8383
Chain endOfChain = request -> service.execute(request).map(RSocketGraphQlResponse::new);
8484

8585
this.executionChain = (interceptors.isEmpty() ? endOfChain :
8686
interceptors.stream()
87-
.reduce(RSocketGraphQlHandlerInterceptor::andThen)
87+
.reduce(RSocketGraphQlInterceptor::andThen)
8888
.map(interceptor -> (Chain) request -> interceptor.intercept(request, endOfChain))
8989
.orElse(endOfChain));
9090
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* @author Rossen Stoyanchev
3636
* @since 1.0.0
3737
*/
38-
public interface RSocketGraphQlHandlerInterceptor {
38+
public interface RSocketGraphQlInterceptor {
3939

4040
/**
4141
* Intercept a request and delegate to the rest of the chain including other
@@ -47,12 +47,12 @@ public interface RSocketGraphQlHandlerInterceptor {
4747
Mono<RSocketGraphQlResponse> intercept(RSocketGraphQlRequest request, Chain chain);
4848

4949
/**
50-
* Return a new {@link RSocketGraphQlHandlerInterceptor} that invokes the current
50+
* Return a new {@link RSocketGraphQlInterceptor} that invokes the current
5151
* interceptor first and then the one that is passed in.
5252
* @param nextInterceptor the interceptor to delegate to after the current
5353
* @return a new interceptor that chains the two
5454
*/
55-
default RSocketGraphQlHandlerInterceptor andThen(RSocketGraphQlHandlerInterceptor nextInterceptor) {
55+
default RSocketGraphQlInterceptor andThen(RSocketGraphQlInterceptor nextInterceptor) {
5656
return (request, chain) -> intercept(request, nextRequest -> nextInterceptor.intercept(nextRequest, chain));
5757
}
5858

spring-graphql/src/main/java/org/springframework/graphql/web/WebGraphQlHandler.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public interface WebGraphQlHandler {
4343

4444
/**
4545
* Return the single interceptor of type
46-
* {@link WebSocketGraphQlHandlerInterceptor} among all the configured
46+
* {@link WebSocketGraphQlInterceptor} among all the configured
4747
* interceptors.
4848
*/
49-
WebSocketGraphQlHandlerInterceptor webSocketInterceptor();
49+
WebSocketGraphQlInterceptor webSocketInterceptor();
5050

5151

5252
/**
@@ -62,7 +62,7 @@ static Builder builder(ExecutionGraphQlService graphQlService) {
6262

6363
/**
6464
* Builder for a {@link WebGraphQlHandler} that executes a
65-
* {@link WebGraphQlHandlerInterceptor} chain followed by a
65+
* {@link WebGraphQlInterceptor} chain followed by a
6666
* {@link ExecutionGraphQlService}.
6767
*/
6868
interface Builder {
@@ -71,22 +71,22 @@ interface Builder {
7171
* Configure interceptors to be invoked before the target
7272
* {@code GraphQlService}.
7373
* <p>One of the interceptors can be of type
74-
* {@link WebSocketGraphQlHandlerInterceptor} to handle data from the
74+
* {@link WebSocketGraphQlInterceptor} to handle data from the
7575
* first {@code ConnectionInit} message expected on a GraphQL over
7676
* WebSocket session, as well as the {@code Complete} message expected
7777
* at the end of a session.
7878
* @param interceptors the interceptors to add
7979
* @return this builder
8080
*/
81-
Builder interceptor(WebGraphQlHandlerInterceptor... interceptors);
81+
Builder interceptor(WebGraphQlInterceptor... interceptors);
8282

8383
/**
84-
* Alternative to {@link #interceptor(WebGraphQlHandlerInterceptor...)}
84+
* Alternative to {@link #interceptor(WebGraphQlInterceptor...)}
8585
* with a List.
8686
* @param interceptors the list of interceptors to add
8787
* @return this builder
8888
*/
89-
Builder interceptors(List<WebGraphQlHandlerInterceptor> interceptors);
89+
Builder interceptors(List<WebGraphQlInterceptor> interceptors);
9090

9191
/**
9292
* Configure accessors for ThreadLocal variables to use to extract
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
*
3838
* @author Rossen Stoyanchev
3939
* @since 1.0.0
40-
* @see WebSocketGraphQlHandlerInterceptor
40+
* @see WebSocketGraphQlInterceptor
4141
*/
42-
public interface WebGraphQlHandlerInterceptor {
42+
public interface WebGraphQlInterceptor {
4343

4444
/**
4545
* Intercept a request and delegate to the rest of the chain including other
@@ -51,12 +51,12 @@ public interface WebGraphQlHandlerInterceptor {
5151
Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain);
5252

5353
/**
54-
* Return a new {@link WebGraphQlHandlerInterceptor} that invokes the current
54+
* Return a new {@link WebGraphQlInterceptor} that invokes the current
5555
* interceptor first and then the one that is passed in.
5656
* @param nextInterceptor the interceptor to delegate to after the current
5757
* @return a new interceptor that chains the two
5858
*/
59-
default WebGraphQlHandlerInterceptor andThen(WebGraphQlHandlerInterceptor nextInterceptor) {
59+
default WebGraphQlInterceptor andThen(WebGraphQlInterceptor nextInterceptor) {
6060
return (request, chain) -> intercept(request, nextRequest -> nextInterceptor.intercept(nextRequest, chain));
6161
}
6262

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121

2222

2323
/**
24-
* An extension of {@link WebGraphQlHandlerInterceptor} with additional methods
24+
* An extension of {@link WebGraphQlInterceptor} with additional methods
2525
* to handle the start and end of a WebSocket connection. Only a single
26-
* interceptor of type {@link WebSocketGraphQlHandlerInterceptor} may be
26+
* interceptor of type {@link WebSocketGraphQlInterceptor} may be
2727
* declared.
2828
*
2929
* @author Rossen Stoyanchev
3030
* @since 1.0.0
3131
*/
32-
public interface WebSocketGraphQlHandlerInterceptor extends WebGraphQlHandlerInterceptor {
32+
public interface WebSocketGraphQlInterceptor extends WebGraphQlInterceptor {
3333

3434
@Override
3535
default Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {

0 commit comments

Comments
 (0)