Skip to content

Commit

Permalink
Merge pull request #278 from jimmypresto/master
Browse files Browse the repository at this point in the history
Allow Request Handler construct and calling for frameworks like Jerse…
  • Loading branch information
oliemansm authored Nov 18, 2020
2 parents 556380d + f8858a2 commit 88a7614
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected GraphQLConfiguration getConfiguration() {
public void init() {
if (configuration == null) {
this.configuration = getConfiguration();
this.requestHandler = new HttpRequestHandlerImpl(configuration);
this.requestHandler = HttpRequestHandlerFactory.create(configuration);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

interface HttpRequestHandler {
public interface HttpRequestHandler {

String APPLICATION_JSON_UTF8 = "application/json;charset=UTF-8";
String APPLICATION_EVENT_STREAM_UTF8 = "text/event-stream;charset=UTF-8";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package graphql.kickstart.servlet;

public interface HttpRequestHandlerFactory {

/**
* Create a Request Handler instance for current servlet constructs
* and frameworks not needing explicit servlet construct (Jersey).
* @param configuration GraphQLConfiguration object
* @return HttpRequestHandler interface instance
*/
static HttpRequestHandler create(GraphQLConfiguration configuration) {
return new HttpRequestHandlerImpl(configuration);
}
}

0 comments on commit 88a7614

Please sign in to comment.