All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.servlet.GraphQLServletListener Maven / Gradle / Ivy

There is a newer version: 6.1.3
Show newest version
package graphql.servlet;

import graphql.GraphQLError;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @author Andrew Potter
 */
public interface GraphQLServletListener {
    default RequestCallback onRequest(HttpServletRequest request, HttpServletResponse response) {
        return null;
    }
    default OperationCallback onOperation(GraphQLContext context, String operationName, String query, Map variables) {
        return null;
    }

    interface RequestCallback {
        default void onSuccess(HttpServletRequest request, HttpServletResponse response) {}
        default void onError(HttpServletRequest request, HttpServletResponse response, Throwable throwable) {}
        default void onFinally(HttpServletRequest request, HttpServletResponse response) {}
    }

    interface OperationCallback {
        default void onSuccess(GraphQLContext context, String operationName, String query, Map variables, Object data, Object extensions) {}
        default void onError(GraphQLContext context, String operationName, String query, Map variables, Object data, List errors, Object extensions) {}
        default void onFinally(GraphQLContext context, String operationName, String query, Map variables, Object data, Object extensions) {}
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy