java.lang.Object
io.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
io.evitadb.externalApi.graphql.io.GraphQLHandler
- All Implemented Interfaces:
io.undertow.server.HttpHandler
public class GraphQLHandler
extends io.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
HTTP request handler for processing
GraphQLRequests and returning GraphQLResponses using passed
configured instance of GraphQL.- Author:
- Lukáš Hornych, FG Forrest a.s. 2022
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final record -
Constructor Summary
ConstructorsConstructorDescriptionGraphQLHandler(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Evita evita, AtomicReference<graphql.GraphQL> graphQL) -
Method Summary
Modifier and TypeMethodDescriptionprotected GraphQLHandler.GraphQLEndpointExchangecreateEndpointExchange(io.undertow.server.HttpServerExchange serverExchange, String httpMethod, String requestBodyMediaType, String preferredResponseMediaType) protected <T extends io.evitadb.externalApi.exception.ExternalApiInternalError>
TcreateInternalError(String message) protected <T extends io.evitadb.externalApi.exception.ExternalApiInternalError>
TcreateInternalError(String message, Throwable cause) protected <T extends io.evitadb.externalApi.exception.ExternalApiInvalidUsageException>
TcreateInvalidUsageException(String message) protected io.evitadb.externalApi.http.EndpointResponsevoidhandleRequest(io.undertow.server.HttpServerExchange serverExchange) protected <T> TparseRequestBody(GraphQLHandler.GraphQLEndpointExchange exchange, Class<T> dataClass) protected voidwriteResult(GraphQLHandler.GraphQLEndpointExchange exchange, OutputStream outputStream, Object response) Methods inherited from class io.evitadb.externalApi.http.EndpointHandler
afterRequestHandled, beforeRequestHandled, readRawRequestBody, validateRequest
-
Constructor Details
-
GraphQLHandler
public GraphQLHandler(@Nonnull com.fasterxml.jackson.databind.ObjectMapper objectMapper, @Nonnull Evita evita, @Nonnull AtomicReference<graphql.GraphQL> graphQL)
-
-
Method Details
-
createEndpointExchange
@Nonnull protected GraphQLHandler.GraphQLEndpointExchange createEndpointExchange(@Nonnull io.undertow.server.HttpServerExchange serverExchange, @Nonnull String httpMethod, @Nullable String requestBodyMediaType, @Nullable String preferredResponseMediaType) - Specified by:
createEndpointExchangein classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
handleRequest
public void handleRequest(io.undertow.server.HttpServerExchange serverExchange) - Specified by:
handleRequestin interfaceio.undertow.server.HttpHandler- Overrides:
handleRequestin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
doHandleRequest
@Nonnull protected io.evitadb.externalApi.http.EndpointResponse doHandleRequest(@Nonnull GraphQLHandler.GraphQLEndpointExchange exchange) - Specified by:
doHandleRequestin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
createInternalError
@Nonnull protected <T extends io.evitadb.externalApi.exception.ExternalApiInternalError> T createInternalError(@Nonnull String message) - Specified by:
createInternalErrorin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
createInternalError
@Nonnull protected <T extends io.evitadb.externalApi.exception.ExternalApiInternalError> T createInternalError(@Nonnull String message, @Nonnull Throwable cause) - Specified by:
createInternalErrorin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
createInvalidUsageException
@Nonnull protected <T extends io.evitadb.externalApi.exception.ExternalApiInvalidUsageException> T createInvalidUsageException(@Nonnull String message) - Specified by:
createInvalidUsageExceptionin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
getSupportedHttpMethods
- Specified by:
getSupportedHttpMethodsin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
getSupportedRequestContentTypes
- Overrides:
getSupportedRequestContentTypesin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
getSupportedResponseContentTypes
- Overrides:
getSupportedResponseContentTypesin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
parseRequestBody
@Nonnull protected <T> T parseRequestBody(@Nonnull GraphQLHandler.GraphQLEndpointExchange exchange, @Nonnull Class<T> dataClass) - Overrides:
parseRequestBodyin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-
writeResult
protected void writeResult(@Nonnull GraphQLHandler.GraphQLEndpointExchange exchange, @Nonnull OutputStream outputStream, @Nonnull Object response) - Overrides:
writeResultin classio.evitadb.externalApi.http.EndpointHandler<GraphQLHandler.GraphQLEndpointExchange>
-