Repository: tomee Updated Branches: refs/heads/master 4a39c0cc2 -> 51e607b81
TOMEE-2071 ensure we fallback for embedded classpath mode on contextRoot in OpenEJBAsyncContext Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/51e607b8 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/51e607b8 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/51e607b8 Branch: refs/heads/master Commit: 51e607b81a44704d9bd5ba28c86c02f7d4e6609c Parents: 4a39c0c Author: rmannibucau <rmannibu...@apache.org> Authored: Wed Jun 21 11:58:04 2017 +0200 Committer: rmannibucau <rmannibu...@apache.org> Committed: Wed Jun 21 11:58:04 2017 +0200 ---------------------------------------------------------------------- .../org/apache/openejb/server/httpd/OpenEJBAsyncContext.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/51e607b8/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/OpenEJBAsyncContext.java ---------------------------------------------------------------------- diff --git a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/OpenEJBAsyncContext.java b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/OpenEJBAsyncContext.java index 979e123..5fe954a 100644 --- a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/OpenEJBAsyncContext.java +++ b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/OpenEJBAsyncContext.java @@ -103,6 +103,7 @@ public class OpenEJBAsyncContext implements AsyncContext { private final Socket socket; private final AsyncEvent event; private WebContext context = null; + private final String contextPath; // fallback if we don't find the context private volatile boolean started = false; private volatile boolean committed = false; private long timeout = 30000; @@ -118,6 +119,7 @@ public class OpenEJBAsyncContext implements AsyncContext { } this.request = request; + this.contextPath = contextPath; if (contextPath != null) { for (final AppContext app : SystemInstance.get().getComponent(ContainerSystem.class).getAppContexts()) { for (final WebContext web : app.getWebContexts()) { @@ -227,7 +229,8 @@ public class OpenEJBAsyncContext implements AsyncContext { public void dispatch(final ServletContext context, final String path) { final HttpListenerRegistry registry = SystemInstance.get().getComponent(HttpListenerRegistry.class); try { - final String contextPath = this.context.getContextRoot().startsWith("/") ? this.context.getContextRoot() : ('/' + this.context.getContextRoot()); + final String contextPath = this.context == null ? + this.contextPath : (this.context.getContextRoot().startsWith("/") ? this.context.getContextRoot() : ('/' + this.context.getContextRoot())); final HttpRequestImpl req = new HttpRequestImpl(new URI(request.getRequestURI())) { private String thisPath = path; private String thisContextPath = contextPath;