You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2019/02/04 23:46:48 UTC

[tomee] 03/06: Enabled welcome document serving for sub-paths as well as root path. I'm sure there is more concise way to code this but it worked for me

This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit dad09352e6d232cc20b8e1ff656955702992eb56
Author: James Meen <ja...@my-managed.net>
AuthorDate: Sun Feb 3 19:09:50 2019 +0000

    Enabled welcome document serving for sub-paths as well as root path. I'm sure there is more concise way to code this but it worked for me
---
 .../java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

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 1fa8b1a..8c9203c 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
@@ -281,9 +281,12 @@ public class CxfRsHttpListener implements RsHttpListener {
                 pathInfo = pathInfo.substring(0, indexOf);
             }
         }
-        if ("/".equals(pathInfo) || pathInfo.isEmpty()) { // root is redirected to welcomefiles
+        if (pathInfo.endsWith("/") || pathInfo.isEmpty()) { // root of path is redirected to welcomefiles
+            if (pathInfo.endsWith("/")) {
+              pathInfo = pathInfo.substring(0, pathInfo.length() - 1);
+            }
             for (final String n : welcomeFiles) {
-                final InputStream is = request.getServletContext().getResourceAsStream(n);
+                final InputStream is = request.getServletContext().getResourceAsStream(pathInfo + n);
                 if (is != null) {
                     return is;
                 }