Class GraphQlSseHandler
java.lang.Object
org.springframework.graphql.server.webmvc.AbstractGraphQlHttpHandler
org.springframework.graphql.server.webmvc.GraphQlSseHandler
GraphQL handler that supports the
GraphQL
Server-Sent Events Protocol and to be exposed as a WebMvc functional endpoint via
RouterFunctions.- Since:
- 1.3.0
- Author:
- Brian Clozel, Rossen Stoyanchev
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.springframework.graphql.server.webmvc.AbstractGraphQlHttpHandler
logger -
Constructor Summary
ConstructorsConstructorDescriptionGraphQlSseHandler(WebGraphQlHandler graphQlHandler) Deprecated, for removal: This API element is subject to removal in a future version.GraphQlSseHandler(WebGraphQlHandler graphQlHandler, @Nullable Duration timeout) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler)GraphQlSseHandler(WebGraphQlHandler graphQlHandler, @Nullable Duration timeout, @Nullable Duration keepAliveDuration) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler) -
Method Summary
Modifier and TypeMethodDescriptionstatic GraphQlSseHandler.Builderbuilder(WebGraphQlHandler graphQlHandler) Return a builder to create aGraphQlSseHandler, e.g.Return the HTTP methods this handler is configured to support.protected Set<graphql.language.OperationDefinition.Operation> Return the GraphQL operation types that this handler supports, regardless of the semantics of any particular request.protected ServerResponseprepareResponse(ServerRequest request, reactor.core.publisher.Mono<WebGraphQlResponse> responseMono) Prepare theServerResponsefor the given GraphQL response.Methods inherited from class org.springframework.graphql.server.webmvc.AbstractGraphQlHttpHandler
findRejection, getWriteFunction, handleRequest
-
Constructor Details
-
GraphQlSseHandler
@Deprecated(since="2.1.0", forRemoval=true) public GraphQlSseHandler(WebGraphQlHandler graphQlHandler) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler)Constructor with the handler to delegate to, and no timeout, i.e. relying on underlying Server async request timeout.- Parameters:
graphQlHandler- the handler to delegate to
-
GraphQlSseHandler
@Deprecated(since="2.1.0", forRemoval=true) public GraphQlSseHandler(WebGraphQlHandler graphQlHandler, @Nullable Duration timeout) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler)Variant constructor with a timeout to use for SSE subscriptions.- Parameters:
graphQlHandler- the handler to delegate totimeout- the timeout value to set onAsyncWebRequest.setTimeout(Long)- Since:
- 1.3.3
-
GraphQlSseHandler
@Deprecated(since="2.1.0", forRemoval=true) public GraphQlSseHandler(WebGraphQlHandler graphQlHandler, @Nullable Duration timeout, @Nullable Duration keepAliveDuration) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler)Variant constructor with a timeout to use for SSE subscriptions.- Parameters:
graphQlHandler- the handler to delegate totimeout- the timeout value to set onkeepAliveDuration- how frequently to send empty comment messages when no other messages are sentAsyncWebRequest.setTimeout(Long)- Since:
- 1.4.0
-
-
Method Details
-
builder
Return a builder to create aGraphQlSseHandler, e.g. to configure which HTTP methods it should support.- Parameters:
graphQlHandler- common handler for GraphQL over HTTP requests- Since:
- 2.1.0
-
getHttpMethods
Return the HTTP methods this handler is configured to support.Applications should use this value when configuring the matching
RequestPredicate, so that both stay in sync.- Since:
- 2.1.0
-
prepareResponse
protected ServerResponse prepareResponse(ServerRequest request, reactor.core.publisher.Mono<WebGraphQlResponse> responseMono) Description copied from class:AbstractGraphQlHttpHandlerPrepare theServerResponsefor the given GraphQL response.- Specified by:
prepareResponsein classAbstractGraphQlHttpHandler- Parameters:
request- the current requestresponseMono- the GraphQL response- Returns:
- the server response
-
getSupportedOperations
Description copied from class:AbstractGraphQlHttpHandlerReturn the GraphQL operation types that this handler supports, regardless of the semantics of any particular request.- Specified by:
getSupportedOperationsin classAbstractGraphQlHttpHandler
-
builder(WebGraphQlHandler)