Class GraphqlServiceContexts
java.lang.Object
com.linecorp.armeria.server.graphql.GraphqlServiceContexts
-
Method Summary
Modifier and TypeMethodDescriptionstatic ServiceRequestContext
get
(graphql.GraphQLContext graphQLContext) Retrieves the currentServiceRequestContext
from the specifiedGraphQLContext
.static ServiceRequestContext
get
(graphql.schema.DataFetchingEnvironment environment) Retrieves the currentServiceRequestContext
from the specifiedDataFetchingEnvironment
.
-
Method Details
-
get
Retrieves the currentServiceRequestContext
from the specifiedGraphQLContext
. For example:new DataFetcher<>() { @Override public String get(DataFetchingEnvironment env) throws Exception { final GraphQLContext graphQLContext = env.getGraphQlContext(); final ServiceRequestContext ctx = GraphqlServiceContexts.get(graphQLContext); // ... } };
- Throws:
IllegalStateException
- if the specifiedGraphQLContext
doesn't contain aServiceRequestContext
.
-
get
Retrieves the currentServiceRequestContext
from the specifiedDataFetchingEnvironment
. For example:new DataFetcher<>() { @Override public String get(DataFetchingEnvironment env) throws Exception { final ServiceRequestContext ctx = GraphqlServiceContexts.get(env); // ... } };
- Throws:
IllegalStateException
- if the specifiedDataFetchingEnvironment
doesn't contain aServiceRequestContext
.
-