Skip to content

Commit 88a7614

Browse files
authored
Merge pull request #278 from jimmypresto/master
Allow Request Handler construct and calling for frameworks like Jerse…
2 parents 556380d + f8858a2 commit 88a7614

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

graphql-java-servlet/src/main/java/graphql/kickstart/servlet/AbstractGraphQLHttpServlet.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected GraphQLConfiguration getConfiguration() {
8383
public void init() {
8484
if (configuration == null) {
8585
this.configuration = getConfiguration();
86-
this.requestHandler = new HttpRequestHandlerImpl(configuration);
86+
this.requestHandler = HttpRequestHandlerFactory.create(configuration);
8787
}
8888
}
8989

graphql-java-servlet/src/main/java/graphql/kickstart/servlet/HttpRequestHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import javax.servlet.http.HttpServletRequest;
44
import javax.servlet.http.HttpServletResponse;
55

6-
interface HttpRequestHandler {
6+
public interface HttpRequestHandler {
77

88
String APPLICATION_JSON_UTF8 = "application/json;charset=UTF-8";
99
String APPLICATION_EVENT_STREAM_UTF8 = "text/event-stream;charset=UTF-8";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package graphql.kickstart.servlet;
2+
3+
public interface HttpRequestHandlerFactory {
4+
5+
/**
6+
* Create a Request Handler instance for current servlet constructs
7+
* and frameworks not needing explicit servlet construct (Jersey).
8+
* @param configuration GraphQLConfiguration object
9+
* @return HttpRequestHandler interface instance
10+
*/
11+
static HttpRequestHandler create(GraphQLConfiguration configuration) {
12+
return new HttpRequestHandlerImpl(configuration);
13+
}
14+
}

0 commit comments

Comments
 (0)