Class GraphQLConfiguration

java.lang.Object
com.graphql_java_generator.client.GraphQLConfiguration

public class GraphQLConfiguration
extends java.lang.Object
This class contains a GraphQL configuration for the GraphQL client. The main element of this configuration contains
Author:
etienne-sf
  • Constructor Summary

    Constructors 
    Constructor Description
    GraphQLConfiguration​(QueryExecutor executor)
    The default constructor, that is used by Spring.
    GraphQLConfiguration​(java.lang.String graphqlEndpoint)
    This constructor expects the URI of the GraphQL server.
    GraphQLConfiguration​(java.lang.String graphqlEndpoint, javax.net.ssl.SSLContext sslContext, javax.net.ssl.HostnameVerifier hostnameVerifier)
    Deprecated.
    GraphQLConfiguration​(java.lang.String graphqlEndpoint, javax.ws.rs.client.Client client)
    Deprecated.
  • Method Summary

    Modifier and Type Method Description
    QueryExecutor getQueryExecutor()
    Retrieves the QueryExecutor for this GraphQL configuration
    static org.springframework.web.reactive.function.client.WebClient getWebClient​(java.lang.String graphqlEndpoint, reactor.netty.http.client.HttpClient httpClient, org.springframework.web.reactive.function.client.ExchangeFilterFunction... filters)
    Builds a Spring reactive WebClient, from the specified parameters.
    Note: this utility can be used if you need to create your own WebClient, for instance to add your own filters to the WebClient
    static org.springframework.web.reactive.socket.client.WebSocketClient getWebSocketClient​(reactor.netty.http.client.HttpClient httpClient)
    Creates the Spring reactive WebSocketClient that will be used for subscriptions.

    Methods inherited from class java.lang.Object

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

    • GraphQLConfiguration

      public GraphQLConfiguration​(QueryExecutor executor)
      The default constructor, that is used by Spring.
    • GraphQLConfiguration

      public GraphQLConfiguration​(java.lang.String graphqlEndpoint)
      This constructor expects the URI of the GraphQL server. This constructor works only for http servers, not for https ones.
      For example: http://my.server.com/graphql
      Parameters:
      graphqlEndpoint - the http URI for the GraphQL endpoint
    • GraphQLConfiguration

      @Deprecated public GraphQLConfiguration​(java.lang.String graphqlEndpoint, javax.net.ssl.SSLContext sslContext, javax.net.ssl.HostnameVerifier hostnameVerifier)
      Deprecated.
      This method is deprecated since version v1.12. It is based on the Jersey Client, but this client has a hard to use the OAuth implementation. The default implementation of this implementation is now based on Spring
      This constructor expects the URI of the GraphQL server. This constructor works only for https servers, not for http ones.
      For example: https://my.server.com/graphql

      SSLContext and HostnameVerifier are regular Java stuff. You'll find lots of documentation on the web. The StarWars sample is based on the http://www.thinkcode.se/blog/2019/01/27/a-jersey-client-supporting-https blog. But this sample implements a noHostVerification, which of course, is the simplest but the safest way to go.
      Parameters:
      graphqlEndpoint - the https URI for the GraphQL endpoint
      sslContext -
      hostnameVerifier -
    • GraphQLConfiguration

      @Deprecated public GraphQLConfiguration​(java.lang.String graphqlEndpoint, javax.ws.rs.client.Client client)
      Deprecated.
      This method is deprecated since version v1.12. It is based on the Jersey Client, but this client has a hard to use the OAuth implementation. The default implementation of this implementation is now based on Spring
      This constructor expects the URI of the GraphQL server and a configured JAX-RS client that gives the opportunity to customize the REST request
      For example: http://my.server.com/graphql
      Parameters:
      graphqlEndpoint - the http URI for the GraphQL endpoint
      client - Client javax.ws.rs.client.Client to support customization of the rest request
  • Method Details

    • getWebClient

      public static org.springframework.web.reactive.function.client.WebClient getWebClient​(java.lang.String graphqlEndpoint, reactor.netty.http.client.HttpClient httpClient, org.springframework.web.reactive.function.client.ExchangeFilterFunction... filters)
      Builds a Spring reactive WebClient, from the specified parameters.
      Note: this utility can be used if you need to create your own WebClient, for instance to add your own filters to the WebClient
      Parameters:
      graphqlEndpoint -
      httpClient -
      filters - Optional list of additional filters that will be added to the returned WebClient
      Returns:
    • getWebSocketClient

      public static org.springframework.web.reactive.socket.client.WebSocketClient getWebSocketClient​(reactor.netty.http.client.HttpClient httpClient)
      Creates the Spring reactive WebSocketClient that will be used for subscriptions.
      Parameters:
      httpClient -
      Returns:
    • getQueryExecutor

      public QueryExecutor getQueryExecutor()
      Retrieves the QueryExecutor for this GraphQL configuration