Rename spring-graphql-web to spring-graphql

Re-purpose spring-graphql-web to be more general than just web and add
org.springframework.web as a top-level package for web support.
This commit is contained in:
Rossen Stoyanchev
2021-04-26 21:41:50 +01:00
parent 1e619263d2
commit 403019521c
38 changed files with 93 additions and 66 deletions

View File

@@ -147,7 +147,7 @@ spring.graphql.websocket.connection-init-timeout=60s
### Extension points
You can contribute [`WebInterceptor` beans](https://github.com/spring-projects-experimental/spring-graphql/blob/master/spring-graphql-web/src/main/java/org/springframework/graphql/WebInterceptor.java)
You can contribute [`WebInterceptor` beans](https://github.com/spring-projects-experimental/spring-graphql/blob/master/spring-graphql/src/main/java/org/springframework/graphql/WebInterceptor.java)
to the application context, so as to customize the `ExecutionInput` or the `ExecutionResult` of the query.
A custom `WebInterceptor` can, for example, change the HTTP request/response headers.

View File

@@ -25,7 +25,7 @@ dependencyManagement {
dependencies {
api project(':spring-graphql-core')
api project(':spring-graphql-web')
api project(':spring-graphql')
api 'com.graphql-java:graphql-java:16.2'
api 'io.projectreactor:reactor-core'
api 'org.springframework:spring-context'

View File

@@ -34,11 +34,11 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.graphql.DefaultWebGraphQLService;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.WebInterceptor;
import org.springframework.graphql.webflux.GraphQLHttpHandler;
import org.springframework.graphql.webflux.GraphQLWebSocketHandler;
import org.springframework.graphql.web.DefaultWebGraphQLService;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.web.WebInterceptor;
import org.springframework.graphql.web.webflux.GraphQLHttpHandler;
import org.springframework.graphql.web.webflux.GraphQLWebSocketHandler;
import org.springframework.http.MediaType;
import org.springframework.http.codec.ServerCodecConfigurer;
import org.springframework.web.reactive.HandlerMapping;

View File

@@ -38,11 +38,11 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.graphql.DefaultWebGraphQLService;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.WebInterceptor;
import org.springframework.graphql.webmvc.GraphQLHttpHandler;
import org.springframework.graphql.webmvc.GraphQLWebSocketHandler;
import org.springframework.graphql.web.DefaultWebGraphQLService;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.web.WebInterceptor;
import org.springframework.graphql.web.webmvc.GraphQLHttpHandler;
import org.springframework.graphql.web.webmvc.GraphQLWebSocketHandler;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;

View File

@@ -31,8 +31,8 @@ import org.springframework.boot.test.context.runner.ReactiveWebApplicationContex
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.graphql.WebInterceptor;
import org.springframework.graphql.WebOutput;
import org.springframework.graphql.web.WebInterceptor;
import org.springframework.graphql.web.WebOutput;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

View File

@@ -28,8 +28,8 @@ import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguratio
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.graphql.WebInterceptor;
import org.springframework.graphql.WebOutput;
import org.springframework.graphql.web.WebInterceptor;
import org.springframework.graphql.web.WebOutput;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;

View File

@@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.test.query.GraphQLTester;
/**

View File

@@ -23,7 +23,7 @@ import reactor.test.StepVerifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.test.query.GraphQLTester;
/**

View File

@@ -16,7 +16,7 @@ pluginManagement {
rootProject.name = 'spring-graphql'
include 'spring-graphql-core',
'spring-graphql-web',
'spring-graphql',
'spring-graphql-test',
'graphql-spring-boot-starter',
'samples:webmvc-http',

View File

@@ -24,7 +24,7 @@ dependencyManagement {
}
dependencies {
api project(':spring-graphql-web')
api project(':spring-graphql')
api 'com.graphql-java:graphql-java:16.2'
api 'io.projectreactor:reactor-core'
api 'org.springframework:spring-context'

View File

@@ -43,8 +43,8 @@ import reactor.core.publisher.Flux;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.graphql.RequestInput;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.WebInput;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.web.WebInput;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.lang.Nullable;

View File

@@ -24,7 +24,7 @@ import graphql.GraphQLError;
import reactor.core.publisher.Flux;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.lang.Nullable;
import org.springframework.test.web.reactive.server.WebTestClient;

View File

@@ -40,9 +40,9 @@ import org.mockito.ArgumentCaptor;
import reactor.core.publisher.Mono;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.WebInput;
import org.springframework.graphql.WebOutput;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.web.WebInput;
import org.springframework.graphql.web.WebOutput;
import org.springframework.http.HttpHeaders;
import org.springframework.lang.Nullable;
import org.springframework.test.web.reactive.server.WebTestClient;

View File

@@ -5,7 +5,7 @@ plugins {
id 'maven'
}
description = "Spring MVC and Spring WebFlux GraphQL Support"
description = "GraphQL Support for Spring Applications"
java {
sourceCompatibility = JavaVersion.VERSION_1_8

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql;
package org.springframework.graphql.web;
import java.util.ArrayList;
import java.util.List;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql;
package org.springframework.graphql.web;
import java.util.concurrent.CompletableFuture;

View File

@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql;
package org.springframework.graphql.web;
import org.springframework.graphql.GraphQLService;
/**
* {@link GraphQLService} for executing GraphQL requests in a Web environment,

View File

@@ -13,11 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql;
package org.springframework.graphql.web;
import java.net.URI;
import java.util.Map;
import org.springframework.graphql.RequestInput;
import org.springframework.http.HttpHeaders;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql;
package org.springframework.graphql.web;
import java.util.function.Consumer;
@@ -21,7 +21,7 @@ import graphql.ExecutionInput;
import graphql.ExecutionResult;
import reactor.core.publisher.Mono;
import org.springframework.graphql.webmvc.GraphQLHttpHandler;
import org.springframework.graphql.web.webmvc.GraphQLHttpHandler;
/**
* Web interceptor for GraphQL queries over HTTP. The interceptor allows
@@ -30,7 +30,7 @@ import org.springframework.graphql.webmvc.GraphQLHttpHandler;
* Spring WebFlux.
*
* <p>A list of interceptors may be provided to {@link GraphQLHttpHandler} or
* to {@link org.springframework.graphql.webflux.GraphQLHttpHandler}. Interceptors are executed in that provided
* to {@link org.springframework.graphql.web.webflux.GraphQLHttpHandler}. Interceptors are executed in that provided
* order where each interceptor sees the {@code ExecutionInput} or the
* {@code ExecutionResult} that was customized by the previous interceptor.
*/

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql;
package org.springframework.graphql.web;
import java.util.Collections;
import java.util.List;

View File

@@ -0,0 +1,21 @@
/*
* Copyright 2020-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@NonNullApi
@NonNullFields
package org.springframework.graphql.web;
import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql.webflux;
package org.springframework.graphql.web.webflux;
import java.util.Map;
@@ -22,8 +22,8 @@ import org.apache.commons.logging.LogFactory;
import reactor.core.publisher.Mono;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.WebInput;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.web.WebInput;
import org.springframework.util.Assert;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql.webflux;
package org.springframework.graphql.web.webflux;
import java.time.Duration;
import java.util.Arrays;
@@ -39,9 +39,9 @@ import org.springframework.core.codec.Decoder;
import org.springframework.core.codec.Encoder;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.WebInput;
import org.springframework.graphql.WebOutput;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.web.WebInput;
import org.springframework.graphql.web.WebOutput;
import org.springframework.http.MediaType;
import org.springframework.http.codec.DecoderHttpMessageReader;
import org.springframework.http.codec.EncoderHttpMessageWriter;

View File

@@ -15,7 +15,7 @@
*/
@NonNullApi
@NonNullFields
package org.springframework.graphql.webflux;
package org.springframework.graphql.web.webflux;
import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql.webmvc;
package org.springframework.graphql.web.webmvc;
import java.io.IOException;
import java.util.Map;
@@ -25,8 +25,8 @@ import org.apache.commons.logging.LogFactory;
import reactor.core.publisher.Mono;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.WebInput;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.web.WebInput;
import org.springframework.util.Assert;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.server.ServerWebInputException;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql.webmvc;
package org.springframework.graphql.web.webmvc;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -41,9 +41,9 @@ import reactor.core.publisher.Mono;
import reactor.core.scheduler.Scheduler;
import reactor.core.scheduler.Schedulers;
import org.springframework.graphql.WebGraphQLService;
import org.springframework.graphql.WebInput;
import org.springframework.graphql.WebOutput;
import org.springframework.graphql.web.WebGraphQLService;
import org.springframework.graphql.web.WebInput;
import org.springframework.graphql.web.WebOutput;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;

View File

@@ -15,7 +15,7 @@
*/
@NonNullApi
@NonNullFields
package org.springframework.graphql.webmvc;
package org.springframework.graphql.web.webmvc;
import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;

View File

@@ -1,4 +1,4 @@
package org.springframework.graphql;
package org.springframework.graphql.web;
public class Book {

View File

@@ -13,12 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql;
package org.springframework.graphql.web;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.graphql.web.WebInterceptor;
import org.springframework.graphql.web.WebOutput;
import static org.assertj.core.api.Assertions.assertThat;
public class ConsumeOneAndNeverCompleteInterceptor implements WebInterceptor {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql;
package org.springframework.graphql.web;
import java.io.File;
import java.net.URI;

View File

@@ -1,4 +1,4 @@
package org.springframework.graphql;
package org.springframework.graphql.web;
import java.util.Arrays;
import java.util.List;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql.webflux;
package org.springframework.graphql.web.webflux;
import java.io.File;
import java.net.URI;
@@ -41,10 +41,10 @@ import reactor.test.StepVerifier;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
import org.springframework.graphql.ConsumeOneAndNeverCompleteInterceptor;
import org.springframework.graphql.DefaultWebGraphQLService;
import org.springframework.graphql.GraphQLDataFetchers;
import org.springframework.graphql.WebInterceptor;
import org.springframework.graphql.web.ConsumeOneAndNeverCompleteInterceptor;
import org.springframework.graphql.web.DefaultWebGraphQLService;
import org.springframework.graphql.web.GraphQLDataFetchers;
import org.springframework.graphql.web.WebInterceptor;
import org.springframework.http.HttpHeaders;
import org.springframework.http.codec.ServerCodecConfigurer;
import org.springframework.http.codec.json.Jackson2JsonDecoder;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql.webmvc;
package org.springframework.graphql.web.webmvc;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -36,10 +36,10 @@ import graphql.schema.idl.TypeDefinitionRegistry;
import org.junit.jupiter.api.Test;
import reactor.test.StepVerifier;
import org.springframework.graphql.ConsumeOneAndNeverCompleteInterceptor;
import org.springframework.graphql.DefaultWebGraphQLService;
import org.springframework.graphql.GraphQLDataFetchers;
import org.springframework.graphql.WebInterceptor;
import org.springframework.graphql.web.ConsumeOneAndNeverCompleteInterceptor;
import org.springframework.graphql.web.DefaultWebGraphQLService;
import org.springframework.graphql.web.GraphQLDataFetchers;
import org.springframework.graphql.web.WebInterceptor;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.converter.HttpMessageConverter;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.graphql.webmvc;
package org.springframework.graphql.web.webmvc;
import java.net.InetSocketAddress;
import java.net.URI;