Class GraphQLEndpoint

java.lang.Object
com.codename1.backend.graphql.GraphQLEndpoint
All Implemented Interfaces:
HttpServer.Handler

public final class GraphQLEndpoint extends Object implements HttpServer.Handler

Serves a GraphQL engine over HTTP, as the GraphQL over HTTP specification describes, and its subscriptions over WebSocket with the graphql-transport-ws protocol -- what Spring for GraphQL serves, under the same settings:

  • spring.graphql.path (/graphql): POST a JSON body with query, operationName and variables, or a body of type application/graphql that is the query itself. GET with the same as query parameters runs a query, never a mutation.
  • spring.graphql.websocket.path: where subscriptions are served. When it is not set and the schema has a subscription type, they are served at spring.graphql.path, which a WebSocket upgrade reaches without colliding with a POST; set it to none to serve none.
  • spring.graphql.graphiql.enabled (false) and spring.graphql.graphiql.path (/graphiql): the GraphiQL page, which loads its scripts from a CDN.

Every response to a document the server could read is 200, its outcome in the body, and is written as application/graphql-response+json unless the client accepts only application/json. A request with no readable document is 400.

Resolvers get the HttpServer.Request as their context over HTTP, and the WebSocketSession over WebSocket. The endpoint sits behind the security filter chain like any route, so SecurityFilterChain rules apply to its paths.