Class GraphQlSseHandler
java.lang.Object
org.springframework.graphql.server.webflux.AbstractGraphQlHttpHandler
org.springframework.graphql.server.webflux.GraphQlSseHandler
GraphQL handler that supports the
GraphQL
Server-Sent Events Protocol and to be exposed as a WebFlux.fn 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.webflux.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 reactor.core.publisher.Mono<ServerResponse> prepareResponse(ServerRequest request, WebGraphQlResponse response) Prepare theServerResponsefor the given GraphQL response.Methods inherited from class org.springframework.graphql.server.webflux.AbstractGraphQlHttpHandler
bodyInserter, findRejection, 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)Basic constructor with the handler to delegate to, and no timeout by default, which results in never timing out.- 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)Constructor with a timeout on how long to wait for the application to return theServerResponsethat will start the stream.- Parameters:
graphQlHandler- the handler to delegate totimeout- the timeout value, ornullto never time out- 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)Constructor with a keep-alive duration that determines how frequently to heartbeats during periods of inactivity.- Parameters:
graphQlHandler- the handler to delegate totimeout- the timeout value to use ornullto never time outkeepAliveDuration- how frequently to send empty comment messages when no other messages are sent- 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 reactor.core.publisher.Mono<ServerResponse> prepareResponse(ServerRequest request, WebGraphQlResponse response) Description copied from class:AbstractGraphQlHttpHandlerPrepare theServerResponsefor the given GraphQL response.- Specified by:
prepareResponsein classAbstractGraphQlHttpHandler- Parameters:
request- the current requestresponse- 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)