Add some API to subscriptionactivating interceptor to make it more

extendible
This commit is contained in:
jamesagnew 2019-11-02 18:14:50 -04:00
parent 89b25ce828
commit 5ad57d9ea9
1 changed files with 11 additions and 2 deletions

View File

@ -97,6 +97,13 @@ public class SubscriptionActivatingInterceptor {
@Autowired
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator;
/**
* Constructor
*/
public SubscriptionActivatingInterceptor() {
super();
}
public boolean activateOrRegisterSubscriptionIfRequired(final IBaseResource theSubscription) {
// Grab the value for "Subscription.channel.type" so we can see if this
// subscriber applies..
@ -271,13 +278,15 @@ public class SubscriptionActivatingInterceptor {
}
}
private void validateChannelEndpoint(CanonicalSubscription theResource) {
@SuppressWarnings("WeakerAccess")
protected void validateChannelEndpoint(CanonicalSubscription theResource) {
if (isBlank(theResource.getEndpointUrl())) {
throw new UnprocessableEntityException("Rest-hook subscriptions must have Subscription.channel.endpoint defined");
}
}
private void validateChannelPayload(CanonicalSubscription theResource) {
@SuppressWarnings("WeakerAccess")
protected void validateChannelPayload(CanonicalSubscription theResource) {
if (!isBlank(theResource.getPayloadString()) && EncodingEnum.forContentType(theResource.getPayloadString()) == null) {
throw new UnprocessableEntityException("Invalid value for Subscription.channel.payload: " + theResource.getPayloadString());
}