Class DefaultExecutionGraphQlRequest
java.lang.Object
org.springframework.graphql.support.DefaultGraphQlRequest
org.springframework.graphql.support.DefaultExecutionGraphQlRequest
- All Implemented Interfaces:
- ExecutionGraphQlRequest,- GraphQlRequest
- Direct Known Subclasses:
- RSocketGraphQlRequest,- WebGraphQlRequest
public class DefaultExecutionGraphQlRequest
extends DefaultGraphQlRequest
implements ExecutionGraphQlRequest
GraphQlRequest for server side handling, adding the transport (e.g. HTTP
 or WebSocket handler) assigned id and locale in the addition to the GraphQlRequest inputs.
 Supports the initialization of ExecutionInput that is passed to
 GraphQL. You can customize that via
 configureExecutionInput(BiFunction).
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev, Brian Clozel
- 
Field SummaryFields inherited from class org.springframework.graphql.support.DefaultGraphQlRequestEXTENSIONS_KEY, OPERATION_NAME_KEY, QUERY_KEY, VARIABLES_KEY
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidconfigureExecutionInput(BiFunction<graphql.ExecutionInput, graphql.ExecutionInput.Builder, graphql.ExecutionInput> configurer) Provide aBiFunctionto help initialize theExecutionInputpassed toGraphQL.voidexecutionId(graphql.execution.ExecutionId executionId) Configure theExecutionIdto set onExecutionInput.getExecutionId(), overriding the transport assignedid.graphql.execution.ExecutionIdReturn the configuredexecutionId.getId()Return the transport assigned id for the request that in turn setsexecutionId.Return the transport assigned locale value, if any.graphql.ExecutionInputCreate theExecutionInputto pass toGraphQL.toString()Methods inherited from class org.springframework.graphql.support.DefaultGraphQlRequestequals, getDocument, getExtensions, getOperationName, getVariables, hashCode, toMapMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.graphql.GraphQlRequestgetDocument, getExtensions, getOperationName, getVariables, toMap
- 
Constructor Details- 
DefaultExecutionGraphQlRequestpublic DefaultExecutionGraphQlRequest(String document, @Nullable String operationName, @Nullable Map<String, Object> variables, @Nullable Map<String, Object> extensions, String id, @Nullable Locale locale) Create an instance.- Parameters:
- document- textual representation of the operation(s)
- operationName- optionally, the name of the operation to execute
- variables- variables by which the query is parameterized
- extensions- implementor specific, protocol extensions
- id- the request id, to be used as the- ExecutionId
- locale- the locale associated with the request
 
 
- 
- 
Method Details- 
getIdDescription copied from interface:ExecutionGraphQlRequestReturn 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 ExecutionGraphQlRequest.executionId(ExecutionId)or configureGraphQLwith anExecutionIdProvider.- Specified by:
- getIdin interface- ExecutionGraphQlRequest
- Returns:
- the request id
 
- On WebFlux, this is the 
- 
executionIdpublic void executionId(graphql.execution.ExecutionId executionId) Description copied from interface:ExecutionGraphQlRequestConfigure theExecutionIdto set onExecutionInput.getExecutionId(), overriding the transport assignedid.- Specified by:
- executionIdin interface- ExecutionGraphQlRequest
- Parameters:
- executionId- the id to use
 
- 
getExecutionIdDescription copied from interface:ExecutionGraphQlRequestReturn the configuredexecutionId.- Specified by:
- getExecutionIdin interface- ExecutionGraphQlRequest
 
- 
getLocaleDescription copied from interface:ExecutionGraphQlRequestReturn the transport assigned locale value, if any.- Specified by:
- getLocalein interface- ExecutionGraphQlRequest
 
- 
configureExecutionInputpublic void configureExecutionInput(BiFunction<graphql.ExecutionInput, graphql.ExecutionInput.Builder, graphql.ExecutionInput> configurer) Description copied from interface:ExecutionGraphQlRequestProvide aBiFunctionto help initialize theExecutionInputpassed toGraphQL. TheExecutionInputis first pre-populated with values from "this"ExecutionGraphQlRequest, and is then customized with the functions provided here.- Specified by:
- configureExecutionInputin interface- ExecutionGraphQlRequest
- Parameters:
- configurer- a- BiFunctionthat accepts the- ExecutionInputinitialized so far, and a builder to customize it.
 
- 
toExecutionInputpublic graphql.ExecutionInput toExecutionInput()Description copied from interface:ExecutionGraphQlRequestCreate theExecutionInputto pass toGraphQL. passed toGraphQL. TheExecutionInputis populated with values from "this"ExecutionGraphQlRequest, and then customized with functions provided viaExecutionGraphQlRequest.configureExecutionInput(BiFunction).- Specified by:
- toExecutionInputin interface- ExecutionGraphQlRequest
- Returns:
- the resulting ExecutionInput
 
- 
toString- Overrides:
- toStringin class- DefaultGraphQlRequest
 
 
-