public final class GraphQLRequestParamUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isGraphQLContentType(String contentType)
Return true if the content type is GraphQL content type (i.e.
|
static String |
queryToGetParamValue(String query)
Convert the GraphQL Query input string into an HTTP GET request parameter value.
|
static GraphQLRequestParams |
toGraphQLRequestParams(Arguments arguments,
String contentEncoding)
Parse
arguments and convert it to a GraphQLRequestParams object if it has valid GraphQL HTTP arguments. |
static GraphQLRequestParams |
toGraphQLRequestParams(byte[] postData,
String contentEncoding)
Parse
postData and convert it to a GraphQLRequestParams object if it is a valid GraphQL post data. |
static String |
toPostBodyString(GraphQLRequestParams params)
Convert the GraphQL request parameters input data to an HTTP POST body string.
|
static String |
variablesToGetParamValue(String variables)
Convert the GraphQL Variables JSON input string into an HTTP GET request parameter value.
|
public static boolean isGraphQLContentType(String contentType)
contentType
- Content-Type valuepublic static String toPostBodyString(GraphQLRequestParams params)
params
- GraphQL request parameter input dataRuntimeException
- if JSON serialization fails for some reason due to any runtime environment issuespublic static String queryToGetParamValue(String query)
query
- the GraphQL Query input stringpublic static String variablesToGetParamValue(String variables)
variables
- the GraphQL Variables JSON input stringpublic static GraphQLRequestParams toGraphQLRequestParams(byte[] postData, String contentEncoding) throws com.fasterxml.jackson.core.JsonProcessingException, UnsupportedEncodingException
postData
and convert it to a GraphQLRequestParams
object if it is a valid GraphQL post data.postData
- post datacontentEncoding
- content encodingGraphQLRequestParams
object form the postData
IllegalArgumentException
- if postData
is not a GraphQL post JSON data or not a valid JSONcom.fasterxml.jackson.core.JsonProcessingException
- if it fails to serialize a parsed JSON object to stringUnsupportedEncodingException
- if it fails to decode parameter valuepublic static GraphQLRequestParams toGraphQLRequestParams(Arguments arguments, String contentEncoding) throws UnsupportedEncodingException
arguments
and convert it to a GraphQLRequestParams
object if it has valid GraphQL HTTP arguments.arguments
- argumentscontentEncoding
- content encodingGraphQLRequestParams
object form the arguments
IllegalArgumentException
- if arguments
does not contain valid GraphQL request argumentsUnsupportedEncodingException
- if it fails to decode parameter valueCopyright © 1998-2021 Apache Software Foundation. All Rights Reserved.