Package dd2480.group4.net
Class RequestHandler
java.lang.Object
- All Implemented Interfaces:
Handler
,Container
,Destroyable
,Dumpable
,LifeCycle
public class RequestHandler extends AbstractHandler
RequestHandler defines the jetty handler for the receiving GitHub webhooks
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.server.handler.AbstractHandler
AbstractHandler.ErrorDispatchHandler
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
-
Constructor Summary
Constructors Constructor Description RequestHandler(Executor executor, NotificationInterface notification)
Constructs a request handler, responsible for handling requests from jetty.RequestHandler(Executor executor, NotificationInterface notification, boolean async)
Constructs a request handler, responsible for handling requests from jetty. -
Method Summary
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler
destroy, doError, doStart, doStop, getServer, setServer
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Constructor Details
-
RequestHandler
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 jobasync
- Specifies whether the handler runs the build executor in a separate thread
-
RequestHandler
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 interfaceHandler
- Specified by:
handle
in classAbstractHandler
- Parameters:
target
- The target of the request - either a URI or a name.baseRequest
- The original unwrapped request object.request
- The request either as theRequest
object or a wrapper of that request. The
method can be used access the Request object if required.HttpConnection.getCurrentConnection()
.getHttpChannel()
.getRequest()
response
- The response as theResponse
object or a wrapper of that request. The
method can be used access the Response object if required.HttpConnection.getCurrentConnection()
.getHttpChannel()
.getResponse()
-