Class AbstractGraphQlHttpHandler

java.lang.Object
org.springframework.graphql.server.webflux.AbstractGraphQlHttpHandler
Direct Known Subclasses:
GraphQlHttpHandler, GraphQlSseHandler

public abstract class AbstractGraphQlHttpHandler extends Object
Abstract base class for GraphQL over HTTP handlers.
Since:
1.3.0
Author:
Brian Clozel, Rossen Stoyanchev
  • Field Details

    • logger

      protected final org.apache.commons.logging.Log logger
  • Constructor Details

  • Method Details

    • prepareResponse

      protected abstract reactor.core.publisher.Mono<ServerResponse> prepareResponse(ServerRequest request, WebGraphQlResponse response)
      Prepare the ServerResponse for the given GraphQL response.
      Parameters:
      request - the current request
      response - the GraphQL response
      Returns:
      the server response
    • getSupportedOperations

      protected abstract Set<graphql.language.OperationDefinition.Operation> getSupportedOperations()
      Return the GraphQL operation types that this handler supports, regardless of the semantics of any particular request.
      Since:
      2.1.0
    • handleRequest

      public reactor.core.publisher.Mono<ServerResponse> handleRequest(ServerRequest request)
      Handle GraphQL over HTTP request.
      Parameters:
      request - the current request
      Returns:
      the resulting response
    • findRejection

      protected static @Nullable OperationNotAllowedException findRejection(WebGraphQlResponse response)
      Find an OperationNotAllowedException rejection in the response errors, if any.

      Must be called on the WebGraphQlResponse before it is turned into a Map, since the exception type is not preserved past that point.

      Parameters:
      response - the GraphQL response before serialization
      Since:
      2.1.0
    • bodyInserter

      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