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 theQueryExecutor
for this GraphQL configurationstatic 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 reactiveWebClient
, from the specified parameters.
Note: this utility can be used if you need to create your ownWebClient
, for instance to add your own filters to theWebClient
static org.springframework.web.reactive.socket.client.WebSocketClient
getWebSocketClient(reactor.netty.http.client.HttpClient httpClient)
Creates the Spring reactiveWebSocketClient
that will be used for subscriptions.
-
Constructor Details
-
GraphQLConfiguration
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 JerseyClient
, 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
andHostnameVerifier
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 endpointsslContext
-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 JerseyClient
, 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 endpointclient
-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 reactiveWebClient
, from the specified parameters.
Note: this utility can be used if you need to create your ownWebClient
, for instance to add your own filters to theWebClient
- Parameters:
graphqlEndpoint
-httpClient
-filters
- Optional list of additional filters that will be added to the returnedWebClient
- Returns:
-
getWebSocketClient
public static org.springframework.web.reactive.socket.client.WebSocketClient getWebSocketClient(reactor.netty.http.client.HttpClient httpClient)Creates the Spring reactiveWebSocketClient
that will be used for subscriptions.- Parameters:
httpClient
-- Returns:
-
getQueryExecutor
Retrieves theQueryExecutor
for this GraphQL configuration
-