22
33import graphql .schema .GraphQLSchema ;
44
5+ import java .util .List ;
6+
57/**
68 * @author Andrew Potter
79 */
@@ -11,8 +13,8 @@ public class SimpleGraphQLHttpServlet extends AbstractGraphQLHttpServlet {
1113 private final GraphQLQueryInvoker queryInvoker ;
1214 private final GraphQLObjectMapper graphQLObjectMapper ;
1315
14- private SimpleGraphQLHttpServlet (GraphQLInvocationInputFactory invocationInputFactory , GraphQLQueryInvoker queryInvoker , GraphQLObjectMapper graphQLObjectMapper , boolean asyncServletMode ) {
15- super (null , asyncServletMode );
16+ private SimpleGraphQLHttpServlet (GraphQLInvocationInputFactory invocationInputFactory , GraphQLQueryInvoker queryInvoker , GraphQLObjectMapper graphQLObjectMapper , List < GraphQLServletListener > listeners , boolean asyncServletMode ) {
17+ super (listeners , asyncServletMode );
1618 this .invocationInputFactory = invocationInputFactory ;
1719 this .queryInvoker = queryInvoker ;
1820 this .graphQLObjectMapper = graphQLObjectMapper ;
@@ -49,6 +51,7 @@ public static class Builder {
4951 private final GraphQLInvocationInputFactory invocationInputFactory ;
5052 private GraphQLQueryInvoker queryInvoker = GraphQLQueryInvoker .newBuilder ().build ();
5153 private GraphQLObjectMapper graphQLObjectMapper = GraphQLObjectMapper .newBuilder ().build ();
54+ private List <GraphQLServletListener > listeners ;
5255 private boolean asyncServletMode ;
5356
5457 Builder (GraphQLInvocationInputFactory invocationInputFactory ) {
@@ -70,8 +73,13 @@ public Builder withAsyncServletMode(boolean asyncServletMode) {
7073 return this ;
7174 }
7275
76+ public Builder withListeners (List <GraphQLServletListener > listeners ) {
77+ this .listeners = listeners ;
78+ return this ;
79+ }
80+
7381 public SimpleGraphQLHttpServlet build () {
74- return new SimpleGraphQLHttpServlet (invocationInputFactory , queryInvoker , graphQLObjectMapper , asyncServletMode );
82+ return new SimpleGraphQLHttpServlet (invocationInputFactory , queryInvoker , graphQLObjectMapper , listeners , asyncServletMode );
7583 }
7684 }
7785}
0 commit comments