diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml
index 9a3228725..c45639810 100644
--- a/gateleen-cache/pom.xml
+++ b/gateleen-cache/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-cache
diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml
index 3c96630f1..c6124598c 100644
--- a/gateleen-core/pom.xml
+++ b/gateleen-core/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-core
diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/util/StatusCode.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/util/StatusCode.java
index 961be9d45..cec6804ae 100644
--- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/util/StatusCode.java
+++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/util/StatusCode.java
@@ -44,7 +44,7 @@ public enum StatusCode {
GONE(410, "Gone"),
LENGTH_REQUIRED(411, "Length Required"),
PRECONDITION_FAILED(412, "Precondition Failed"),
- CONTENT_TOO_LARGE(413, "Content Too Large"),
+ PAYLOAD_TOO_LARGE(413, "Payload Too Large"),
URI_TOO_LONG(414, "URI Too Long"),
UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"),
RANGE_NOT_SATISFIABLE(416, "Range Not Satisfiable"),
diff --git a/gateleen-delegate/README_delegate.md b/gateleen-delegate/README_delegate.md
index 0cfa74938..8601bc926 100644
--- a/gateleen-delegate/README_delegate.md
+++ b/gateleen-delegate/README_delegate.md
@@ -265,3 +265,7 @@ Also you have to enable the logging on the [DelegateHandler](src/main/java/org/s
```java
delegateHandler.enableResourceLogging(true);
```
+### Unmatched delegate handling
+The default implementation of _Delegate_ and _DelegateHandler_ end the original request with `200 OK` when the _pattern_ or the _methods_ do not match.
+
+To override this behaviour, a _StatusCode_ can be provided in the constructor of _DelegateHandler_ as `unmatchedDelegateStatusCode` to define how the original requests should be responded when the called delegate does not match.
\ No newline at end of file
diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml
index ed5664922..3374b2244 100644
--- a/gateleen-delegate/pom.xml
+++ b/gateleen-delegate/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-delegate
diff --git a/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/Delegate.java b/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/Delegate.java
index 85968aa64..f1aa6cc52 100644
--- a/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/Delegate.java
+++ b/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/Delegate.java
@@ -18,6 +18,7 @@
import org.swisspush.gateleen.core.util.HttpServerRequestUtil;
import org.swisspush.gateleen.core.util.StatusCode;
+import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -43,6 +44,7 @@ public class Delegate {
private final Pattern pattern;
private final Set methods;
private final List requests;
+ private final StatusCode unmatchedDelegateStatusCode;
private boolean delegateContainsJoltSpecRequest = false;
/**
@@ -54,12 +56,15 @@ public class Delegate {
* @param methods methods of the delegate
* @param requests requests of the delegate
*/
- public Delegate(final ClientRequestCreator clientRequestCreator, final String name, final Pattern pattern, final Set methods, final List requests) {
+ public Delegate(final ClientRequestCreator clientRequestCreator, final String name, final Pattern pattern,
+ final Set methods, final List requests,
+ @Nullable StatusCode unmatchedDelegateStatusCode) {
this.clientRequestCreator = clientRequestCreator;
this.name = name;
this.pattern = pattern;
this.methods = methods;
this.requests = requests;
+ this.unmatchedDelegateStatusCode = unmatchedDelegateStatusCode;
this.delegateContainsJoltSpecRequest = doesDelegateContainJoltSpecRequest();
}
@@ -107,8 +112,15 @@ public void handle(final HttpServerRequest request) {
}
}
- // end response, if nothing matches
- request.response().end();
+ // when delegate not matched and status code is defined, respond with defined status code
+ if(unmatchedDelegateStatusCode != null) {
+ request.response().setStatusCode(unmatchedDelegateStatusCode.getStatusCode());
+ request.response().setStatusMessage(unmatchedDelegateStatusCode.getStatusMessage());
+ request.response().end();
+ } else {
+ // when delegate not matched and no status code is defined, just end response with 200 OK
+ request.response().end();
+ }
}
/**
diff --git a/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/DelegateFactory.java b/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/DelegateFactory.java
index a3c101662..966ac2d5f 100644
--- a/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/DelegateFactory.java
+++ b/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/DelegateFactory.java
@@ -12,11 +12,13 @@
import org.swisspush.gateleen.core.json.transform.JoltSpec;
import org.swisspush.gateleen.core.json.transform.JoltSpecBuilder;
import org.swisspush.gateleen.core.json.transform.JoltSpecException;
+import org.swisspush.gateleen.core.util.StatusCode;
import org.swisspush.gateleen.core.util.StringUtils;
import org.swisspush.gateleen.core.validation.ValidationResult;
import org.swisspush.gateleen.validation.ValidationException;
import org.swisspush.gateleen.validation.Validator;
+import javax.annotation.Nullable;
import java.util.*;
import java.util.regex.Pattern;
@@ -40,17 +42,22 @@ public class DelegateFactory {
private final Map properties;
private final String delegatesSchema;
+ private final StatusCode unmatchedDelegateStatusCode;
+
/**
* Creates a new instance of the DelegateFactory.
*
* @param clientRequestCreator
* @param properties
* @param delegatesSchema
+ * @param unmatchedDelegateStatusCode
*/
- public DelegateFactory(final ClientRequestCreator clientRequestCreator, final Map properties, final String delegatesSchema) {
+ public DelegateFactory(final ClientRequestCreator clientRequestCreator, final Map properties,
+ final String delegatesSchema, @Nullable StatusCode unmatchedDelegateStatusCode) {
this.clientRequestCreator = clientRequestCreator;
this.properties = properties;
this.delegatesSchema = delegatesSchema;
+ this.unmatchedDelegateStatusCode = unmatchedDelegateStatusCode;
}
/**
@@ -125,7 +132,7 @@ private Delegate createDelegate(final String delegateName, final String configSt
requests.add(new DelegateRequest(requestJsonObject, joltSpec, headerFunction));
}
- return new Delegate(clientRequestCreator, delegateName, pattern, methods, requests);
+ return new Delegate(clientRequestCreator, delegateName, pattern, methods, requests, unmatchedDelegateStatusCode);
}
private JoltSpec parsePayloadTransformSpec(JsonObject requestJsonObject, String delegateName) throws ValidationException {
diff --git a/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/DelegateHandler.java b/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/DelegateHandler.java
index c67c4590d..9ed410f65 100644
--- a/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/DelegateHandler.java
+++ b/gateleen-delegate/src/main/java/org/swisspush/gateleen/delegate/DelegateHandler.java
@@ -18,9 +18,9 @@
import org.swisspush.gateleen.core.storage.ResourceStorage;
import org.swisspush.gateleen.core.util.ResourcesUtils;
import org.swisspush.gateleen.core.util.StatusCode;
-import org.swisspush.gateleen.monitoring.MonitoringHandler;
import org.swisspush.gateleen.validation.ValidationException;
+import javax.annotation.Nullable;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
@@ -83,22 +83,37 @@ public class DelegateHandler implements Refreshable, LoggableResource {
* @param vertx vertx
* @param selfClient selfClient
* @param delegateStorage delegateStorage - only used for storing delegates
- * @param monitoringHandler monitoringHandler
* @param delegatesUri delegate root
* @param properties properties
* @param doneHandler doneHandler
*/
public DelegateHandler(final Vertx vertx, final HttpClient selfClient, final ResourceStorage delegateStorage,
- final MonitoringHandler monitoringHandler, final String delegatesUri,
- final Map properties,
- final Handler doneHandler) {
+ final String delegatesUri, final Map properties, final Handler doneHandler) {
+ this(vertx, selfClient, delegateStorage, delegatesUri, properties, null, doneHandler);
+ }
+
+ /**
+ * Creates a new instance of the DelegateHandler.
+ *
+ * @param vertx vertx
+ * @param selfClient selfClient
+ * @param delegateStorage delegateStorage - only used for storing delegates
+ * @param delegatesUri delegate root
+ * @param properties properties
+ * @param unmatchedDelegateStatusCode respond requests with this status code when not matched
+ * @param doneHandler doneHandler
+ */
+ public DelegateHandler(final Vertx vertx, final HttpClient selfClient, final ResourceStorage delegateStorage,
+ final String delegatesUri, final Map properties,
+ @Nullable StatusCode unmatchedDelegateStatusCode, final Handler doneHandler) {
this.vertx = vertx;
this.delegateStorage = delegateStorage;
this.delegatesUri = delegatesUri;
this.doneHandler = doneHandler;
String delegatesSchema = ResourcesUtils.loadResource("gateleen_delegate_schema_delegates", true);
- this.delegateFactory = new DelegateFactory(new ClientRequestCreator(selfClient), properties, delegatesSchema);
+ this.delegateFactory = new DelegateFactory(new ClientRequestCreator(selfClient), properties,
+ delegatesSchema, unmatchedDelegateStatusCode);
delegateNamePattern = Pattern.compile(delegatesUri + "([^/]+)(/" + DEFINITION_RESOURCE + "|/"+ EXECUTION_RESOURCE + ".*" + "|/?)");
diff --git a/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateFactoryTest.java b/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateFactoryTest.java
index d6bcb039e..91d146992 100644
--- a/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateFactoryTest.java
+++ b/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateFactoryTest.java
@@ -66,7 +66,7 @@ public void setUp() {
Mockito.when(vertx.eventBus()).thenReturn(Mockito.mock(EventBus.class));
Map properties = new HashMap<>();
- delegateFactory = new DelegateFactory(new ClientRequestCreator(Mockito.mock(HttpClient.class)), properties, delegatesSchema);
+ delegateFactory = new DelegateFactory(new ClientRequestCreator(Mockito.mock(HttpClient.class)), properties, delegatesSchema, null);
}
@Test
diff --git a/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/TestDelegateHandler.java b/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateHandlerTest.java
similarity index 60%
rename from gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/TestDelegateHandler.java
rename to gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateHandlerTest.java
index 51e0805fa..6f9119c40 100644
--- a/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/TestDelegateHandler.java
+++ b/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateHandlerTest.java
@@ -1,21 +1,38 @@
package org.swisspush.gateleen.delegate;
+import io.vertx.core.http.HttpMethod;
+import io.vertx.core.http.HttpServerResponse;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.mockito.Mockito;
+import org.swisspush.gateleen.core.http.DummyHttpServerRequest;
+
+import static org.mockito.Mockito.verifyNoInteractions;
/**
- * Tests some features of the DelegateHandler.
+ * Tests some features of the {@link DelegateHandler}.
*
* @author https://github.com/ljucam [Mario Ljuca]
*/
-public class TestDelegateHandler {
+public class DelegateHandlerTest {
private static final String DELEGATE_URI = "/gateleen/server/delegate/v1/delegates/";
private static DelegateHandler delegateHandler;
@BeforeClass
public static void init() {
- delegateHandler = new DelegateHandler(null, null, null, null, DELEGATE_URI, null, null);
+ delegateHandler = new DelegateHandler(null, null, null, DELEGATE_URI,
+ null, null);
+ }
+
+ @Test
+ public void testHandle() {
+ String delegateName = "aName";
+ HttpServerResponse response = Mockito.mock(HttpServerResponse.class);
+
+ verifyNoInteractions(response);
+ Assert.assertFalse(delegateHandler.handle(new CustomHttpServerRequest(DELEGATE_URI + delegateName + "/blah", response)));
+ Assert.assertFalse(delegateHandler.handle(new CustomHttpServerRequest(DELEGATE_URI + delegateName, response)));
}
@Test
@@ -55,4 +72,29 @@ public void testGetDelegateName_Recognition() {
// --------------
}
+
+ private static class CustomHttpServerRequest extends DummyHttpServerRequest {
+
+ private final String uri;
+ private final HttpServerResponse response;
+
+ public CustomHttpServerRequest(String uri, HttpServerResponse response) {
+ this.uri = uri;
+ this.response = response;
+ }
+
+ @Override public String uri() {
+ return uri;
+ }
+
+ @Override public HttpMethod method() {
+ return HttpMethod.GET;
+ }
+
+ @Override
+ public HttpServerResponse response() {
+ return response != null ? response : super.response();
+ }
+
+ }
}
diff --git a/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java b/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java
index 2f157082b..8d228d145 100644
--- a/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java
+++ b/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java
@@ -1,13 +1,13 @@
package org.swisspush.gateleen.delegate;
+import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.MultiMap;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.eventbus.EventBus;
-
import io.vertx.core.http.HttpMethod;
-
+import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.http.impl.headers.HeadersMultiMap;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
@@ -20,6 +20,7 @@
import org.swisspush.gateleen.core.http.ClientRequestCreator;
import org.swisspush.gateleen.core.http.DummyHttpServerRequest;
import org.swisspush.gateleen.core.http.LocalHttpClient;
+import org.swisspush.gateleen.core.util.StatusCode;
import org.swisspush.gateleen.validation.ValidationException;
import java.util.HashMap;
@@ -38,9 +39,12 @@
public class DelegateTest {
private final String VALID_DELEGATE = loadResource("valid_delegate", true);
+ private final String VALID_DELEGATE_NOT_MATCHING = loadResource("valid_delegate_not_matching", true);
private final String VALID_DYNAMIC_HEADERS_DELEGATE = loadResource("valid_dynamic_headers_delegate", true);
private final String VALID_HEADER_DEFINITON_DELEGATE = loadResource("valid_header_definition_delegate", true);
+ private final String VALID_TRANSFORM_PROPERTY_DELEGATE = loadResource("valid_transform_delegate", true);
+
private final GateleenExceptionFactory exceptionFactory = newGateleenWastefulExceptionFactory();
private String delegatesSchema = loadResource("gateleen_delegate_schema_delegates", true);
@@ -54,7 +58,64 @@ public void setUp() {
final LocalHttpClient selfClient = new LocalHttpClient(vertx, exceptionFactory);
selfClient.setRoutingContexttHandler(event -> {});
clientRequestCreator = Mockito.spy(new ClientRequestCreator(selfClient));
- delegateFactory = new DelegateFactory(clientRequestCreator, new HashMap<>(), delegatesSchema);
+ delegateFactory = new DelegateFactory(clientRequestCreator, new HashMap<>(), delegatesSchema, null);
+ }
+
+ @Test
+ public void testNotMatchingDelegateWithNoDefinedResponseStatusCode(TestContext context) throws ValidationException {
+ Delegate delegate = delegateFactory.parseDelegate("someDelegate",
+ Buffer.buffer(VALID_DELEGATE_NOT_MATCHING));
+
+ HttpServerResponse response = Mockito.mock(HttpServerResponse.class);
+
+ CustomHttpServerRequest request = new CustomHttpServerRequest("/gateleen/playground/foobar", HttpMethod.PUT,
+ MultiMap.caseInsensitiveMultiMap(), null, response
+ );
+
+ delegate.handle(request);
+
+ verifyNoInteractions(clientRequestCreator);
+ verify(response, never()).setStatusCode(anyInt());
+ verify(response, never()).setStatusMessage(anyString());
+ verify(response, times(1)).end();
+ }
+
+ @Test
+ public void testNotMatchingDelegateWithDefinedResponseStatusCode(TestContext context) throws ValidationException {
+ delegateFactory = new DelegateFactory(clientRequestCreator, new HashMap<>(), delegatesSchema, StatusCode.NOT_IMPLEMENTED);
+ Delegate delegate = delegateFactory.parseDelegate("someDelegate",
+ Buffer.buffer(VALID_DELEGATE_NOT_MATCHING));
+
+ HttpServerResponse response = Mockito.mock(HttpServerResponse.class);
+
+ CustomHttpServerRequest request = new CustomHttpServerRequest("/gateleen/playground/foobar", HttpMethod.PUT,
+ MultiMap.caseInsensitiveMultiMap(),null, response
+ );
+
+ delegate.handle(request);
+
+ verifyNoInteractions(clientRequestCreator);
+ verify(response, times(1)).setStatusCode(eq(StatusCode.NOT_IMPLEMENTED.getStatusCode()));
+ verify(response, times(1)).setStatusMessage(StatusCode.NOT_IMPLEMENTED.getStatusMessage());
+ verify(response, times(1)).end();
+ }
+
+ @Test
+ public void testTransformationWithInvalidOriginalPayload(TestContext context) throws ValidationException {
+ Delegate delegate = delegateFactory.parseDelegate("someDelegate",
+ Buffer.buffer(VALID_TRANSFORM_PROPERTY_DELEGATE));
+
+ HttpServerResponse response = Mockito.mock(HttpServerResponse.class);
+ CustomHttpServerRequest request = new CustomHttpServerRequest("/gateleen/playground/foobar", HttpMethod.PUT,
+ MultiMap.caseInsensitiveMultiMap(), Buffer.buffer("{"), response
+ );
+
+ delegate.handle(request);
+
+ verifyNoInteractions(clientRequestCreator);
+ verify(response, times(1)).setStatusCode(eq(StatusCode.BAD_REQUEST.getStatusCode()));
+ verify(response, times(1)).setStatusMessage(StatusCode.BAD_REQUEST.getStatusMessage());
+ verify(response, times(1)).end(startsWith("Unable to parse payload of delegate execution request"));
}
@Test
@@ -154,10 +215,19 @@ private static class CustomHttpServerRequest extends DummyHttpServerRequest {
private final HttpMethod method;
private final MultiMap headers;
+ private final HttpServerResponse response;
+ private final Buffer requestBody;
+
public CustomHttpServerRequest(String uri, HttpMethod method, MultiMap headers) {
+ this(uri, method, headers, null, null);
+ }
+
+ public CustomHttpServerRequest(String uri, HttpMethod method, MultiMap headers, Buffer requestBody, HttpServerResponse response) {
this.uri = uri;
this.method = method;
this.headers = headers;
+ this.requestBody = requestBody;
+ this.response = response;
}
@Override public HttpMethod method() {
@@ -168,5 +238,14 @@ public CustomHttpServerRequest(String uri, HttpMethod method, MultiMap headers)
}
@Override public MultiMap headers() { return headers; }
+ @Override
+ public HttpServerResponse response() {
+ return response != null ? response : super.response();
+ }
+
+ @Override
+ public Future body() {
+ return requestBody != null ? Future.succeededFuture(requestBody) : super.body();
+ }
}
}
diff --git a/gateleen-delegate/src/test/resources/valid_delegate_not_matching b/gateleen-delegate/src/test/resources/valid_delegate_not_matching
new file mode 100644
index 000000000..3fec59493
--- /dev/null
+++ b/gateleen-delegate/src/test/resources/valid_delegate_not_matching
@@ -0,0 +1,14 @@
+{
+ "methods": [ "PUT" ],
+ "pattern": ".*/execution/notmatching/(.*)",
+ "requests": [
+ {
+ "method": "POST",
+ "uri": "/gateleen/server/v1/copy",
+ "payload": {
+ "source": "/gateleen/$1?expand=100&zip=true",
+ "destination": "/gateleen/zips/users/$1.zip"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml
index c18f85b14..1fecc47b8 100644
--- a/gateleen-delta/pom.xml
+++ b/gateleen-delta/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-delta
diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml
index 9c28e553d..cd4fa1dd5 100644
--- a/gateleen-expansion/pom.xml
+++ b/gateleen-expansion/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-expansion
diff --git a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java
index 3ffeac1b1..59f309d43 100755
--- a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java
+++ b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java
@@ -34,6 +34,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import static org.swisspush.gateleen.core.util.StatusCode.INTERNAL_SERVER_ERROR;
+import static org.swisspush.gateleen.core.util.StatusCode.PAYLOAD_TOO_LARGE;
import static org.swisspush.gateleen.routing.RuleFeatures.Feature.EXPAND_ON_BACKEND;
import static org.swisspush.gateleen.routing.RuleFeatures.Feature.STORAGE_EXPAND;
import static org.swisspush.gateleen.routing.RuleProvider.RuleChangesObserver;
@@ -544,7 +545,11 @@ private void makeStorageExpandRequest(final String targetUri, final List subReso
return;
}
cRes.bodyHandler(data -> {
- if (StatusCode.INTERNAL_SERVER_ERROR.getStatusCode() == cRes.statusCode()) {
+ if (StatusCode.PAYLOAD_TOO_LARGE.getStatusCode() == cRes.statusCode()) {
+ String fullResponseBody = data.toString();
+ log.info("{}: {}: {}", PAYLOAD_TOO_LARGE, targetUri, fullResponseBody);
+ handler.handle(new ResourceNode(SERIOUS_EXCEPTION, new ResourceCollectionException(fullResponseBody, PAYLOAD_TOO_LARGE)));
+ } else if (StatusCode.INTERNAL_SERVER_ERROR.getStatusCode() == cRes.statusCode()) {
String fullResponseBody = data.toString();
log.error("{}: {}: {}", INTERNAL_SERVER_ERROR, targetUri, fullResponseBody);
handler.handle(new ResourceNode(SERIOUS_EXCEPTION, new ResourceCollectionException(fullResponseBody, StatusCode.INTERNAL_SERVER_ERROR)));
diff --git a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/RecursiveRootHandlerBase.java b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/RecursiveRootHandlerBase.java
index b09360b44..b99b45af5 100755
--- a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/RecursiveRootHandlerBase.java
+++ b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/RecursiveRootHandlerBase.java
@@ -34,6 +34,7 @@ void handleResponseError(final HttpServerRequest req, final ResourceCollectionEx
ResponseStatusCodeLogUtil.debug(req, exception.getStatusCode(), RecursiveRootHandlerBase.class);
req.response().setStatusCode(exception.getStatusCode().getStatusCode());
req.response().setStatusMessage(exception.getStatusCode().getStatusMessage());
+ req.response().putHeader("Content-Type", "text/plain");
req.response().end(exception.getMessage());
}
diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml
index 74aeebd7f..59455301d 100644
--- a/gateleen-hook-js/pom.xml
+++ b/gateleen-hook-js/pom.xml
@@ -4,7 +4,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-hook-js
jar
diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml
index c7ffb8b86..d0c5e3ca2 100644
--- a/gateleen-hook/pom.xml
+++ b/gateleen-hook/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-hook
diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml
index cc5d5134c..c58d33a08 100644
--- a/gateleen-kafka/pom.xml
+++ b/gateleen-kafka/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-kafka
diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml
index 52a6b8fe0..8a6ba5a5f 100644
--- a/gateleen-logging/pom.xml
+++ b/gateleen-logging/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-logging
diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml
index 0ed189633..1ac048c6e 100644
--- a/gateleen-merge/pom.xml
+++ b/gateleen-merge/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-merge
diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml
index 93721503d..d5fbb3a8d 100644
--- a/gateleen-monitoring/pom.xml
+++ b/gateleen-monitoring/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-monitoring
diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml
index 4f04e7d5a..5298ffb32 100644
--- a/gateleen-packing/pom.xml
+++ b/gateleen-packing/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-packing
diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml
index da414dbf0..de137f487 100644
--- a/gateleen-player/pom.xml
+++ b/gateleen-player/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-player
diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml
index c0d308138..e1cf9a818 100644
--- a/gateleen-playground/pom.xml
+++ b/gateleen-playground/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-playground
diff --git a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java
index 816e8f250..612a0b0a7 100755
--- a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java
+++ b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java
@@ -291,7 +291,7 @@ public void start() {
zipExtractHandler = new ZipExtractHandler(selfClient);
- delegateHandler = new DelegateHandler(vertx, selfClient, storage, monitoringHandler,
+ delegateHandler = new DelegateHandler(vertx, selfClient, storage,
SERVER_ROOT + "/admin/v1/delegates/", props, null);
delegateHandler.enableResourceLogging(true);
diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml
index 0b4d8f8a0..7bb5aea47 100644
--- a/gateleen-qos/pom.xml
+++ b/gateleen-qos/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-qos
diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml
index 21d95520a..7cc56c55d 100644
--- a/gateleen-queue/pom.xml
+++ b/gateleen-queue/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-queue
diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml
index 07d13403e..07b9b4dbe 100644
--- a/gateleen-routing/pom.xml
+++ b/gateleen-routing/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-routing
diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml
index 8c7c34907..8d4324df2 100644
--- a/gateleen-runconfig/pom.xml
+++ b/gateleen-runconfig/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-runconfig
diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml
index dfa07db25..1fcfbf677 100644
--- a/gateleen-scheduler/pom.xml
+++ b/gateleen-scheduler/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-scheduler
diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml
index 30e121d0e..0fc3067c4 100644
--- a/gateleen-security/pom.xml
+++ b/gateleen-security/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-security
diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml
index 4beb9415e..8611850de 100644
--- a/gateleen-test/pom.xml
+++ b/gateleen-test/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-test
jar
diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java
index 64741b9a6..b02253c5d 100755
--- a/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java
+++ b/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java
@@ -191,8 +191,8 @@ public static void setupBeforeClass(TestContext context) {
LogController logController = new LogController();
logController.registerLogConfiguratorMBean(JMX_DOMAIN);
ZipExtractHandler zipExtractHandler = new ZipExtractHandler(selfClient);
- DelegateHandler delegateHandler = new DelegateHandler(vertx, selfClient, storage, monitoringHandler,
- DELEGATE_ROOT, props, null);
+ DelegateHandler delegateHandler = new DelegateHandler(vertx, selfClient, storage, DELEGATE_ROOT,
+ props, null);
MergeHandler mergeHandler = new MergeHandler(selfClient);
cacheHandler = new CacheHandler(
diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml
index a10c670c2..05882f11d 100644
--- a/gateleen-testhelper/pom.xml
+++ b/gateleen-testhelper/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-testhelper
diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml
index 69b9e5c25..4f69e7b6d 100644
--- a/gateleen-user/pom.xml
+++ b/gateleen-user/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-user
diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml
index 1a4944347..391d4c537 100644
--- a/gateleen-validation/pom.xml
+++ b/gateleen-validation/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
gateleen-validation
diff --git a/pom.xml b/pom.xml
index c4da97afd..5cecd732f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
org.swisspush.gateleen
gateleen
- 2.1.5-SNAPSHOT
+ 2.1.7-SNAPSHOT
pom
gateleen
Middleware library based on Vert.x to build advanced JSON/REST communication servers