Class GraphQLEndpoint
java.lang.Object
com.codename1.backend.graphql.GraphQLEndpoint
- All Implemented Interfaces:
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):POSTa JSON body withquery,operationNameandvariables, or a body of typeapplication/graphqlthat is the query itself.GETwith 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 atspring.graphql.path, which a WebSocket upgrade reaches without colliding with aPOST; set it tononeto serve none.spring.graphql.graphiql.enabled(false) andspring.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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringThe deepest selection nesting a document may have; seeGraphQL.Builder.maxDepth(int).static final StringThe most fields a document may select, aliases and fragment spreads counted where they expand; seeGraphQL.Builder.maxFields(int).static final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic GraphQLEndpointfromConfig(Config config, GraphQL.Builder builder) The endpoint for the enginebuilderbuilds, configured fromconfig: the paths above, and introspection and the depth limit on the engine.The engine.getPath()The HTTP path.Where subscriptions are served, or null.handle(HttpServer.Request request) static GraphQLEndpointAn endpoint servinggraphQLatpath, with subscriptions atwebSocketPath(or none for null) and no GraphiQL page.voidRegisters the subscription endpoint, when there is one.
-
Field Details
-
PATH
- See Also:
-
WEBSOCKET_PATH
- See Also:
-
GRAPHIQL_ENABLED
- See Also:
-
GRAPHIQL_PATH
- See Also:
-
INTROSPECTION
- See Also:
-
MAX_DEPTH
The deepest selection nesting a document may have; seeGraphQL.Builder.maxDepth(int).- See Also:
-
MAX_FIELDS
The most fields a document may select, aliases and fragment spreads counted where they expand; seeGraphQL.Builder.maxFields(int).- See Also:
-
-
Method Details
-
fromConfig
The endpoint for the enginebuilderbuilds, configured fromconfig: the paths above, and introspection and the depth limit on the engine.- Throws:
IOException
-
of
An endpoint servinggraphQLatpath, with subscriptions atwebSocketPath(or none for null) and no GraphiQL page. -
getGraphQL
The engine. -
getPath
The HTTP path. -
getWebSocketPath
Where subscriptions are served, or null. -
registerWebSocket
Registers the subscription endpoint, when there is one. -
handle
- Specified by:
handlein interfaceHttpServer.Handler- Throws:
Exception
-