Skip to content

Commit 58791d1

Browse files
committed
added generic headers to http notification
1 parent 8f1d865 commit 58791d1

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

roda-core/roda-core/src/main/java/org/roda/core/common/notifications/HTTPNotificationProcessor.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ private boolean post(String endpoint, String content, int timeout) {
108108
httppost
109109
.setEntity(new StringEntity(content, ContentType.create("application/json", RodaConstants.DEFAULT_ENCODING)));
110110

111+
String key = RodaCoreFactory.getRodaConfigurationAsString("core.notification.header.key");
112+
String value = RodaCoreFactory.getRodaConfigurationAsString("core.notification.header.value");
113+
if (key != null && !key.isEmpty() && value != null && !value.isEmpty()) {
114+
httppost.setHeader(key, value);
115+
}
116+
111117
HttpResponse response = httpclient.execute(httppost);
112118
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
113119
success = false;

roda-core/roda-core/src/main/resources/config/roda-core.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ core.notification.template_path = mail/templates/
254254
core.notification.ingest_subject = RODA ingest process finished - {RESULT}
255255
core.notification.default_subject = RODA process finished - {RESULT}
256256
core.notification.package = org.roda.core.plugins.base.notifications
257+
#core.notification.header.key =
258+
#core.notification.header.value =
257259

258260
# parameter.notification.EmailGenericException.enable = true
259261
# parameter.notification.EmailGenericException.to = test@roda.com

0 commit comments

Comments
 (0)