Class AbstractWebhookProcessor
java.lang.Object
com.cloudbees.jenkins.plugins.bitbucket.impl.webhook.AbstractWebhookProcessor
- All Implemented Interfaces:
BitbucketWebhookProcessor
,ExtensionPoint
- Direct Known Subclasses:
CloudPullRequestWebhookProcessor
,CloudPushWebhookProcessor
,PluginPullRequestWebhookProcessor
,PluginPushWebhookProcessor
,ServerPingWebhookProcessor
,ServerPullRequestWebhookProcessor
,ServerPushWebhookProcessor
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public abstract class AbstractWebhookProcessor
extends Object
implements BitbucketWebhookProcessor
Abstract hook processor.
Add new hook processors by extending this class and implement
BitbucketWebhookProcessor.process(String, String, Map, BitbucketEndpoint)
,
extract details from the hook payload and then fire an SCMEvent
to dispatch it to the SCM API.-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
protected final Logger
protected static final String
protected static final String
protected static final String
protected static final String
Fields inherited from interface com.cloudbees.jenkins.plugins.bitbucket.api.webhook.BitbucketWebhookProcessor
SCAN_ON_EMPTY_CHANGES_PROPERTY_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEventType
(Map<String, String> headers, org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Extracts the event type that represent the payload in the request.protected String
getServerURL
(Map<String, String> headers, org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Extracts the server URL from where this request coming from, the URL must match one of the configuredBitbucketEndpoint
s.protected void
scmSourceReIndex
(String owner, String repository, String mirrorId) To be called by implementations once the owner and the repository have been extracted from the payload.void
verifyPayload
(Map<String, String> headers, String body, BitbucketEndpoint endpoint) The implementation must verify if the incoming request is secured or not eventually gather some settings from the givenBitbucketEndpoint
configuration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.cloudbees.jenkins.plugins.bitbucket.api.webhook.BitbucketWebhookProcessor
buildHookContext, canHandle, notifyEvent, process, reindexOnEmptyChanges
-
Field Details
-
logger
-
REQUEST_ID_CLOUD_HEADER
- See Also:
-
REQUEST_ID_SERVER_HEADER
- See Also:
-
SIGNATURE_HEADER
- See Also:
-
EVENT_TYPE_HEADER
- See Also:
-
SERVER_URL_PARAMETER
- See Also:
-
-
Constructor Details
-
AbstractWebhookProcessor
public AbstractWebhookProcessor()
-
-
Method Details
-
scmSourceReIndex
To be called by implementations once the owner and the repository have been extracted from the payload.- Parameters:
owner
- the repository owner as configured in the SCMSourcerepository
- the repository name as configured in the SCMSourcemirrorId
- the mirror id if applicable, may be null
-
getServerURL
@NonNull public String getServerURL(@NonNull Map<String, String> headers, @NonNull org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Description copied from interface:BitbucketWebhookProcessor
Extracts the server URL from where this request coming from, the URL must match one of the configuredBitbucketEndpoint
s.- Specified by:
getServerURL
in interfaceBitbucketWebhookProcessor
- Parameters:
headers
- requestparameters
- request- Returns:
- the URL of the server from where this request has been sent.
-
getEventType
@NonNull public String getEventType(@NonNull Map<String, String> headers, @NonNull org.apache.commons.collections4.MultiValuedMap<String, String> parameters) Description copied from interface:BitbucketWebhookProcessor
Extracts the event type that represent the payload in the request.- Specified by:
getEventType
in interfaceBitbucketWebhookProcessor
- Parameters:
headers
- requestparameters
- request- Returns:
- the event type key.
-
verifyPayload
public void verifyPayload(@NonNull Map<String, String> headers, @NonNull String body, @NonNull BitbucketEndpoint endpoint) throws BitbucketWebhookProcessorExceptionDescription copied from interface:BitbucketWebhookProcessor
The implementation must verify if the incoming request is secured or not eventually gather some settings from the givenBitbucketEndpoint
configuration.- Specified by:
verifyPayload
in interfaceBitbucketWebhookProcessor
- Parameters:
headers
- requestbody
- requestendpoint
- configured for the givenBitbucketWebhookProcessor.getServerURL(Map, MultiValuedMap)
- Throws:
BitbucketWebhookProcessorException
- when signature verification fails
-
getOrigin
-