diff --git a/spring-graphql/src/main/java/org/springframework/graphql/RequestInput.java b/spring-graphql/src/main/java/org/springframework/graphql/RequestInput.java index 01a13f1a..c5fa633c 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/RequestInput.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/RequestInput.java @@ -86,8 +86,12 @@ public class RequestInput { } /** - * Return the explicitly assigned request id. + * Return an identifier for the request. This id is later propagated + * as the {@link ExecutionId} of the execution input. + *
For web transports, this identifier can be used to correlate + * request and response messages on a multiplexed connection. * @return the request id. + * @see GraphQL over WebSocket Protocol */ public String getId() { return this.id; diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlHttpHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlHttpHandler.java index 50f63a78..9aa4a6a1 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlHttpHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlHttpHandler.java @@ -25,9 +25,7 @@ import reactor.core.publisher.Mono; import org.springframework.core.ParameterizedTypeReference; import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.web.WebInput; -import org.springframework.util.AlternativeJdkIdGenerator; import org.springframework.util.Assert; -import org.springframework.util.IdGenerator; import org.springframework.web.reactive.function.server.ServerRequest; import org.springframework.web.reactive.function.server.ServerResponse; @@ -48,26 +46,13 @@ public class GraphQlHttpHandler { private final WebGraphQlHandler graphQlHandler; - private final IdGenerator idGenerator; - /** * Create a new instance. * @param graphQlHandler common handler for GraphQL over HTTP requests */ public GraphQlHttpHandler(WebGraphQlHandler graphQlHandler) { - this(graphQlHandler, new AlternativeJdkIdGenerator()); - } - - /** - * Create a new instance. - * @param graphQlHandler common handler for GraphQL over HTTP requests - * @param idGenerator Id generator for requests - */ - public GraphQlHttpHandler(WebGraphQlHandler graphQlHandler, IdGenerator idGenerator) { Assert.notNull(graphQlHandler, "WebGraphQlHandler is required"); - Assert.notNull(idGenerator, "IdGenerator is required"); this.graphQlHandler = graphQlHandler; - this.idGenerator = idGenerator; } /** @@ -81,7 +66,7 @@ public class GraphQlHttpHandler { WebInput input = new WebInput( request.uri(), request.headers().asHttpHeaders(), body, request.exchange().getLocaleContext().getLocale(), - this.idGenerator.generateId().toString()); + request.exchange().getRequest().getId()); if (logger.isDebugEnabled()) { logger.debug("Executing: " + input); } diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlHttpHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlHttpHandler.java index 402799ed..be130b52 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlHttpHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlHttpHandler.java @@ -52,28 +52,17 @@ public class GraphQlHttpHandler { private static final ParameterizedTypeReference