treat / as a different path for cxf jaxrs resource handling integration - due to tomcat 8.5.6 upgrade
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/823790b9 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/823790b9 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/823790b9 Branch: refs/heads/tomee-1.7.x Commit: 823790b98af391c721e1d4103fc94c6d688f1de5 Parents: 4e1571d Author: rmannibucau <rmannibu...@apache.org> Authored: Wed Oct 12 16:52:18 2016 +0200 Committer: rmannibucau <rmannibu...@apache.org> Committed: Wed Oct 12 16:52:18 2016 +0200 ---------------------------------------------------------------------- ...AvoidConflictWithWebXmlWithNoResourceMatchingTest.java | 4 ++-- .../apache/openejb/server/cxf/rs/CxfRsHttpListener.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/823790b9/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/staticresources/AvoidConflictWithWebXmlWithNoResourceMatchingTest.java ---------------------------------------------------------------------- diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/staticresources/AvoidConflictWithWebXmlWithNoResourceMatchingTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/staticresources/AvoidConflictWithWebXmlWithNoResourceMatchingTest.java index dd8de77..8ebbf44 100644 --- a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/staticresources/AvoidConflictWithWebXmlWithNoResourceMatchingTest.java +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/staticresources/AvoidConflictWithWebXmlWithNoResourceMatchingTest.java @@ -74,12 +74,12 @@ public class AvoidConflictWithWebXmlWithNoResourceMatchingTest { // but it would be not deterministic otherwise so not better @Test(expected = FileNotFoundException.class) public void jsp() throws IOException { - assertEquals("JSP 5", IO.slurp(new URL(url + "index.jsp")).trim()); + IO.slurp(new URL(url + "index.jsp")); } @Test(expected = FileNotFoundException.class) // same as for jsp() public void home() throws IOException { - assertEquals("JSP 5", IO.slurp(url).trim()); + IO.slurp(url); } @Test http://git-wip-us.apache.org/repos/asf/tomee/blob/823790b9/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java index e08ca05..7bede36 100644 --- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java +++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java @@ -279,16 +279,16 @@ public class CxfRsHttpListener implements RsHttpListener { pathInfo = pathInfo.substring(0, indexOf); } } - InputStream is = request.getServletContext().getResourceAsStream(pathInfo); - if (is == null && ("/".equals(pathInfo) || pathInfo.isEmpty())) { + if ("/".equals(pathInfo) || pathInfo.isEmpty()) { // root is redirected to welcomefiles for (final String n : welcomeFiles) { - is = request.getServletContext().getResourceAsStream(n); + final InputStream is = request.getServletContext().getResourceAsStream(n); if (is != null) { - break; + return is; } } + return null; // "/" resolves to an empty string otherwise, we need to avoid it } - return is; + return request.getServletContext().getResourceAsStream(pathInfo); } public boolean serveStaticContent(final HttpServletRequest request,