Class GraphiQlHandler

java.lang.Object
org.springframework.graphql.server.webmvc.GraphiQlHandler

public class GraphiQlHandler extends Object
Spring MVC handler to serve a GraphiQl UI page.
Since:
1.0.0
Author:
Brian Clozel, Rossen Stoyanchev
  • Constructor Details

    • GraphiQlHandler

      public GraphiQlHandler(String graphQlPath, String graphQlWsPath)
      Constructor that serves the default graphiql/index.html included in the spring-graphql module.
      Parameters:
      graphQlPath - the path to the GraphQL HTTP endpoint
      graphQlWsPath - optional path to the GraphQL WebSocket endpoint
    • GraphiQlHandler

      public GraphiQlHandler(String graphQlPath, String graphQlWsPath, Resource htmlResource)
      Constructor with the HTML page to serve.
      Parameters:
      graphQlPath - the path to the GraphQL HTTP endpoint
      graphQlWsPath - optional path to the GraphQL WebSocket endpoint
      htmlResource - the GraphiQL page to serve
  • Method Details

    • handleRequest

      public ServerResponse handleRequest(ServerRequest request)
      Render the GraphiQL page as "text/html", or if the "path" query parameter is missing, add it and redirect back to the same URL.
      Parameters:
      request - the HTTP server request