Class GraphQLController

java.lang.Object
io.micronaut.configuration.graphql.GraphQLController

@Controller("${graphql.path:/graphql}") public class GraphQLController extends Object
The GraphQL controller handling GraphQL requests.
Since:
1.0
Author:
Marcel Overdijk, James Kleeh, Alexey Zhokhov
  • Constructor Summary

    Constructors
    Constructor
    Description
    GraphQLController(GraphQLInvocation graphQLInvocation, GraphQLExecutionResultHandler graphQLExecutionResultHandler, GraphQLJsonSerializer graphQLJsonSerializer)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>>
    get(String query, @Nullable String operationName, @Nullable String variables, io.micronaut.http.HttpRequest httpRequest)
    Handles GraphQL GET requests.
    org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>>
    post(@Nullable String query, @Nullable String operationName, @Nullable String variables, @Nullable String body, io.micronaut.http.HttpRequest httpRequest)
    Handles GraphQL POST requests.
    org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>>
    postMultipart(io.micronaut.http.server.multipart.MultipartBody body, io.micronaut.http.HttpRequest<?> httpRequest)
    Handles GraphQL POST multipart requests.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • get

      @Get(produces={"application/json","*/*"}, single=true) public org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>> get(@QueryValue("query") String query, @QueryValue("operationName") @Nullable String operationName, @QueryValue("variables") @Nullable String variables, io.micronaut.http.HttpRequest httpRequest)
      Handles GraphQL GET requests.
      Parameters:
      query - the GraphQL query
      operationName - the GraphQL operation name
      variables - the GraphQL variables
      httpRequest - the HTTP request
      Returns:
      the GraphQL response
    • postMultipart

      @ExecuteOn("blocking") @Post(consumes="multipart/form-data", produces="application/json", single=true) public org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>> postMultipart(@Body io.micronaut.http.server.multipart.MultipartBody body, io.micronaut.http.HttpRequest<?> httpRequest)
      Handles GraphQL POST multipart requests.
      Parameters:
      body - the multipart request body
      httpRequest - the HTTP request
      Returns:
      the GraphQL response
    • post

      @Post(consumes="*/*", produces={"application/json","*/*"}, single=true) public org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<String>> post(@QueryValue("query") @Nullable String query, @QueryValue("operationName") @Nullable String operationName, @QueryValue("variables") @Nullable String variables, @Body @Nullable String body, io.micronaut.http.HttpRequest httpRequest)
      Handles GraphQL POST requests.
      Parameters:
      query - the GraphQL query
      operationName - the GraphQL operation name
      variables - the GraphQL variables
      body - the GraphQL request body
      httpRequest - the HTTP request
      Returns:
      the GraphQL response