public class WebHookManager extends Object implements HookManager
Constructor and Description |
---|
WebHookManager()
Create a HookManager to handle GitLab webhook events.
|
WebHookManager(String secretToken)
Create a HookManager to handle GitLab webhook events which will be verified
against the specified secretToken.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(WebHookListener listener)
Adds a WebHook event listener.
|
protected void |
fireBuildEvent(BuildEvent buildEvent) |
void |
fireEvent(Event event)
Fire the event to the registered listeners.
|
protected void |
fireIssueEvent(IssueEvent issueEvent) |
protected void |
fireJobEvent(JobEvent jobEvent) |
protected void |
fireMergeRequestEvent(MergeRequestEvent mergeRequestEvent) |
protected void |
fireNoteEvent(NoteEvent noteEvent) |
protected void |
firePipelineEvent(PipelineEvent pipelineEvent) |
protected void |
firePushEvent(PushEvent pushEvent) |
protected void |
fireTagPushEvent(TagPushEvent tagPushEvent) |
protected void |
fireWikiPageEvent(WikiPageEvent wikiPageEvent) |
String |
getSecretToken()
Get the secret token that received hook events should be validated against.
|
void |
handleEvent(Event event)
Verifies the provided Event and fires it off to the registered listeners.
|
void |
handleEvent(javax.servlet.http.HttpServletRequest request)
Parses and verifies an Event instance from the HTTP request and
fires it off to the registered listeners.
|
Event |
handleRequest(javax.servlet.http.HttpServletRequest request)
Parses and verifies an Event instance from the HTTP request and
fires it off to the registered listeners.
|
void |
removeListener(WebHookListener listener)
Removes a WebHook event listener.
|
void |
setSecretToken(String secretToken)
Set the secret token that received hook events should be validated against.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isValidSecretToken, isValidSecretToken
public WebHookManager()
public WebHookManager(String secretToken)
secretToken
- the secret token to verify againstpublic String getSecretToken()
getSecretToken
in interface HookManager
public void setSecretToken(String secretToken)
setSecretToken
in interface HookManager
secretToken
- the secret token to verify againstpublic void handleEvent(javax.servlet.http.HttpServletRequest request) throws GitLabApiException
handleEvent
in interface HookManager
request
- the HttpServletRequest to read the Event instance fromGitLabApiException
- if the parsed event is not supportedpublic Event handleRequest(javax.servlet.http.HttpServletRequest request) throws GitLabApiException
request
- the HttpServletRequest to read the Event instance fromGitLabApiException
- if the parsed event is not supportedpublic void handleEvent(Event event) throws GitLabApiException
event
- the Event instance to handleGitLabApiException
- if the event is not supportedpublic void addListener(WebHookListener listener)
listener
- the SystemHookListener to addpublic void removeListener(WebHookListener listener)
listener
- the SystemHookListener to removepublic void fireEvent(Event event) throws GitLabApiException
event
- the Event instance to fire to the registered event listenersGitLabApiException
- if the event is not supportedprotected void fireBuildEvent(BuildEvent buildEvent)
protected void fireIssueEvent(IssueEvent issueEvent)
protected void fireJobEvent(JobEvent jobEvent)
protected void fireMergeRequestEvent(MergeRequestEvent mergeRequestEvent)
protected void fireNoteEvent(NoteEvent noteEvent)
protected void firePipelineEvent(PipelineEvent pipelineEvent)
protected void firePushEvent(PushEvent pushEvent)
protected void fireTagPushEvent(TagPushEvent tagPushEvent)
protected void fireWikiPageEvent(WikiPageEvent wikiPageEvent)
Copyright © 2019. All rights reserved.