Package org.springframework.graphql
Interface ExecutionGraphQlRequest
- All Superinterfaces:
GraphQlRequest
- All Known Implementing Classes:
DefaultExecutionGraphQlRequest,RSocketGraphQlRequest,WebGraphQlRequest,WebSocketGraphQlRequest
Implementation of
GraphQlRequest for request handling through GraphQL
Java with support for customizing the ExecutionInput passed into
GraphQL.- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev, Brian Clozel
-
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureExecutionInput(BiFunction<ExecutionInput, ExecutionInput.Builder, ExecutionInput> configurer) voidexecutionId(ExecutionId executionId) Configure theExecutionIdto set onExecutionInput.getExecutionId(), overriding the transport assignedid.Return the configuredexecutionId.getId()Return the transport assigned id for the request that in turn setsexecutionId.Return the transport assigned locale value, if any.Create theExecutionInputto pass toGraphQL.Methods inherited from interface org.springframework.graphql.GraphQlRequest
getDocument, getExtensions, getOperationName, getVariables, toMap
-
Method Details
-
getId
String getId()Return the transport assigned id for the request that in turn setsexecutionId.By default, the id is initialized as follows:
- On WebFlux, this is the
ServerHttpRequestid which correlates to WebFlux log messages. For Reactor Netty, it also correlates to server log messages. - On Spring MVC, the id is generated via
AlternativeJdkIdGenerator, which does not correlate to anything, but is more efficient than the defaultExecutionIdProviderwhich relies onUUID.randomUUID(). - On WebSocket, the id is set to the message id of the
"subscribe"message from the GraphQL over WebSocket protocol that is used to correlate request and response messages on the the WebSocket.
To override this id, use
executionId(ExecutionId)or configureGraphQLwith anExecutionIdProvider.- Returns:
- the request id
- On WebFlux, this is the
-
executionId
Configure theExecutionIdto set onExecutionInput.getExecutionId(), overriding the transport assignedid.- Parameters:
executionId- the id to use
-
getExecutionId
Return the configuredexecutionId. -
getLocale
Return the transport assigned locale value, if any. -
configureExecutionInput
void configureExecutionInput(BiFunction<ExecutionInput, ExecutionInput.Builder, ExecutionInput> configurer) Provide aBiFunctionto help initialize theExecutionInputpassed toGraphQL. TheExecutionInputis first pre-populated with values from "this"ExecutionGraphQlRequest, and is then customized with the functions provided here.- Parameters:
configurer- aBiFunctionthat accepts theExecutionInputinitialized so far, and a builder to customize it.
-
toExecutionInput
ExecutionInput toExecutionInput()Create theExecutionInputto pass toGraphQL. passed toGraphQL. TheExecutionInputis populated with values from "this"ExecutionGraphQlRequest, and then customized with functions provided viaconfigureExecutionInput(BiFunction).- Returns:
- the resulting
ExecutionInput
-