Class AbstractGraphQlHttpHandler
java.lang.Object
org.springframework.graphql.server.webflux.AbstractGraphQlHttpHandler
- Direct Known Subclasses:
GraphQlHttpHandler,GraphQlSseHandler
Abstract base class for GraphQL over HTTP handlers.
- Since:
- 1.3.0
- Author:
- Brian Clozel, Rossen Stoyanchev
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractGraphQlHttpHandler(WebGraphQlHandler graphQlHandler, @Nullable CodecConfigurer codecConfigurer) -
Method Summary
Modifier and TypeMethodDescriptionprotected BodyInserter<WebGraphQlResponse, ServerHttpResponse> bodyInserter(WebGraphQlResponse response) Create a body inserter function that knows how to write the GraphQL response as a JSON HTTP response body.protected static @Nullable OperationNotAllowedExceptionfindRejection(WebGraphQlResponse response) Find anOperationNotAllowedExceptionrejection in the response errors, if any.protected abstract Set<graphql.language.OperationDefinition.Operation> Return the GraphQL operation types that this handler supports, regardless of the semantics of any particular request.reactor.core.publisher.Mono<ServerResponse> handleRequest(ServerRequest request) Handle GraphQL over HTTP request.protected abstract reactor.core.publisher.Mono<ServerResponse> prepareResponse(ServerRequest request, WebGraphQlResponse response) Prepare theServerResponsefor the given GraphQL response.
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
AbstractGraphQlHttpHandler
protected AbstractGraphQlHttpHandler(WebGraphQlHandler graphQlHandler, @Nullable CodecConfigurer codecConfigurer)
-
-
Method Details
-
prepareResponse
protected abstract reactor.core.publisher.Mono<ServerResponse> prepareResponse(ServerRequest request, WebGraphQlResponse response) Prepare theServerResponsefor the given GraphQL response.- Parameters:
request- the current requestresponse- the GraphQL response- Returns:
- the server response
-
getSupportedOperations
Return the GraphQL operation types that this handler supports, regardless of the semantics of any particular request.- Since:
- 2.1.0
-
handleRequest
Handle GraphQL over HTTP request.- Parameters:
request- the current request- Returns:
- the resulting response
-
findRejection
Find anOperationNotAllowedExceptionrejection in the response errors, if any.Must be called on the
WebGraphQlResponsebefore it is turned into aMap, since the exception type is not preserved past that point.- Parameters:
response- the GraphQL response before serialization- Since:
- 2.1.0
-
bodyInserter
protected BodyInserter<WebGraphQlResponse, ServerHttpResponse> bodyInserter(WebGraphQlResponse response) Create a body inserter function that knows how to write the GraphQL response as a JSON HTTP response body.- Parameters:
response- the response to write out- Returns:
- the body inserter to use for writing the GraphQL response to the HTTP message
- Since:
- 2.1.0
-