diff --git a/README.md b/README.md index e419ac929b..6b82a5dc38 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,21 @@ It is available in editions for all major platforms (Java SE/EE, Google App Engi It is available under the terms of either the Apache Software License 2.0 or the Eclipse Public License 1.0. -http://restlet.com +http://restlet.talend.com ## Learn more To learn more about Restlet Framework, please have a look at the following resources: -* [User Guide](http://restlet.com/technical-resources/restlet-framework/guide/2.3) -* [Tutorials](http://restlet.com/technical-resources/restlet-framework/tutorials/2.3) -* [JavaDocs](http://restlet.com/technical-resources/restlet-framework/javadocs/2.3) -* [Change Log](http://restlet.com/technical-resources/restlet-framework/misc/2.3/changes) -* [Download](http://restlet.com/downloads/current/) +* [User Guide](https://restlet.talend.com/documentation/user-guide/2.3/) +* [Tutorials](https://restlet.talend.com/documentation/tutorials/2.3/) +* [JavaDocs](https://restlet.talend.com/documentation/javadocs/2.3/) +* [Change Log](https://restlet.talend.com/documentation/2.3/changelog) +* [Download](https://restlet.talend.com/downloads/current/) * [Issue Tracker](https://github.com/restlet/restlet-framework-java/issues) * [Mailing List](https://groups.google.com/a/restlet.org/forum/#!forum/framework-discuss) * [Stack Overflow](http://stackoverflow.com/questions/tagged/restlet) -Copyright 2015 Restlet +Copyright 2019 Talend [![Build Status](https://travis-ci.org/restlet/restlet-framework-java.svg?branch=2.3)](https://travis-ci.org/restlet/restlet-framework-java) diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/ApplicationContextTestCase.java b/modules/org.restlet.test/src/org/restlet/test/engine/ApplicationContextTestCase.java index 26a17030a2..bf4391677e 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/ApplicationContextTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/ApplicationContextTestCase.java @@ -10,6 +10,7 @@ import org.restlet.resource.Get; import org.restlet.resource.ServerResource; import org.restlet.routing.Router; +import org.restlet.service.ConnectorService; import org.restlet.test.RestletTestCase; /** @@ -34,6 +35,20 @@ public String hello() { } } + public static class WebApiConnectorService extends ConnectorService { + private boolean called = false; + + @Override + public void beforeSend(Representation entity) { + super.beforeSend(entity); + this.called = true; + } + + public boolean wasCalled() { + return called; + } + } + public static class WebApiApplication extends Application { @Override public Restlet createInboundRoot() { @@ -54,6 +69,7 @@ public String hello() { } private Component component; + private WebApiConnectorService connectorService; @Override protected void setUp() throws Exception { @@ -61,7 +77,10 @@ protected void setUp() throws Exception { this.component = new Component(); this.component.getServers().add(Protocol.HTTP, TEST_PORT); - component.getDefaultHost().attach("/api", new WebApiApplication()); + this.connectorService = new WebApiConnectorService(); + WebApiApplication webApiApplication = new WebApiApplication(); + webApiApplication.setConnectorService(this.connectorService); + component.getDefaultHost().attach("/api", webApiApplication); component.getInternalRouter().attach("/internal", new InternalApplication()); component.start(); @@ -77,4 +96,10 @@ public void testApplicationContext() throws Exception { Representation rep = res.get(MediaType.TEXT_PLAIN); assertEquals("WebApiApplication", rep.getText()); } + + public void testCurrentApplicationNotClearedBeforeSend() throws Exception { + ClientResource res = new ClientResource("http://localhost:" + TEST_PORT + "/api/test"); + Representation rep = res.get(MediaType.TEXT_PLAIN); + assertTrue(this.connectorService.wasCalled()); + } } diff --git a/modules/org.restlet/src/org/restlet/engine/application/ApplicationHelper.java b/modules/org.restlet/src/org/restlet/engine/application/ApplicationHelper.java index 13b93a10af..273c3ae9b4 100644 --- a/modules/org.restlet/src/org/restlet/engine/application/ApplicationHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/application/ApplicationHelper.java @@ -77,7 +77,9 @@ public void handle(Request request, Response response) { super.handle(request, response); } finally { // restaure the current application - Application.setCurrent(current); + if (current != null) { + Application.setCurrent(current); + } } }