Class RequestHandler

All Implemented Interfaces:
Handler, Container, Destroyable, Dumpable, LifeCycle

public class RequestHandler
extends AbstractHandler
RequestHandler defines the jetty handler for the receiving GitHub webhooks
  • Constructor Details

    • RequestHandler

      public RequestHandler​(Executor executor, NotificationInterface notification, boolean async)
      Constructs a request handler, responsible for handling requests from jetty. The request handler listens for webhooks and starts a new build with the given Executor
      Parameters:
      executor - the Executor responsible for running the build job
      async - Specifies whether the handler runs the build executor in a separate thread
    • RequestHandler

      public RequestHandler​(Executor executor, NotificationInterface notification)
      Constructs a request handler, responsible for handling requests from jetty. The request handler listens for webhooks and starts a new build with the given Executor
      Parameters:
      executor - the Executor responsible for running the build job
  • Method Details

    • handle

      public void handle​(java.lang.String target, Request baseRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      handle defines the actual handler used by jetty to respond to HTTP requests. It expects the webhook JSON in the body of a HTTP request. The handler validates the json, starts the build in a new thread and returns 200.
      Specified by:
      handle in interface Handler
      Specified by:
      handle in class AbstractHandler
      Parameters:
      target - The target of the request - either a URI or a name.
      baseRequest - The original unwrapped request object.
      request - The request either as the Request object or a wrapper of that request. The HttpConnection.getCurrentConnection().getHttpChannel().getRequest() method can be used access the Request object if required.
      response - The response as the Response object or a wrapper of that request. The HttpConnection.getCurrentConnection().getHttpChannel().getResponse() method can be used access the Response object if required.