diff --git a/test/core/src/test/java/org/gatein/wci/test/crosscontext/CrossContextServlet.java b/test/core/src/test/java/org/gatein/wci/test/crosscontext/CrossContextServlet.java index 20ca541c8..f7797086b 100644 --- a/test/core/src/test/java/org/gatein/wci/test/crosscontext/CrossContextServlet.java +++ b/test/core/src/test/java/org/gatein/wci/test/crosscontext/CrossContextServlet.java @@ -64,9 +64,8 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se // HttpSession session = req.getSession(false); - if (session != null) - { - throw new ServletException("Was not expecting a session to exist"); + if (session != null) { + throw new ServletException("Was not expecting a session to exist"); } // Authenticate @@ -77,24 +76,20 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se String id = session.getId(); // - String dispatchedId = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback() - { - @Override - public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException - { - if (dispatchedReq.getSession(false) != null) - { - throw new ServletException("Was not expecting a session to exist"); - } - HttpSession dispatchedSession = dispatchedReq.getSession(); - dispatchedSession.setAttribute("payload", "foo"); - return dispatchedSession.getId(); - } + String dispatchedId = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback() { + @Override + public Object doCallback(ServletContext dispatchedCtx, + HttpServletRequest dispatchedReq, + HttpServletResponse dispatchedResp, + Object handback) throws ServletException, IOException { + HttpSession dispatchedSession = dispatchedReq.getSession(); + dispatchedSession.setAttribute("payload", "foo"); + return dispatchedSession.getId(); + } }, null); // - if (!id.equals(dispatchedId)) - { + if (!id.equals(dispatchedId)) { throw new ServletException("Was expecting session ids to be the same"); } diff --git a/test/servers/pom.xml b/test/servers/pom.xml index c12e2d9f0..76fad27ac 100644 --- a/test/servers/pom.xml +++ b/test/servers/pom.xml @@ -27,7 +27,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. GateIn - WCI test servers - tomcat8 + tomcat diff --git a/test/servers/tomcat8/pom.xml b/test/servers/tomcat/pom.xml similarity index 89% rename from test/servers/tomcat8/pom.xml rename to test/servers/tomcat/pom.xml index de2476cbe..58c00dbfa 100644 --- a/test/servers/tomcat8/pom.xml +++ b/test/servers/tomcat/pom.xml @@ -72,17 +72,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. org.apache.tomcat.embed tomcat-embed-jasper - - jakarta.servlet.jsp - jakarta.servlet.jsp-api - provided - - - jakarta.servlet - jakarta.servlet-api - provided - - diff --git a/test/servers/tomcat8/src/main/java/org/gatein/wci/test/tomcat/AuthenticationRealm.java b/test/servers/tomcat/src/main/java/org/gatein/wci/test/tomcat/AuthenticationRealm.java similarity index 100% rename from test/servers/tomcat8/src/main/java/org/gatein/wci/test/tomcat/AuthenticationRealm.java rename to test/servers/tomcat/src/main/java/org/gatein/wci/test/tomcat/AuthenticationRealm.java diff --git a/test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/authentication/AuthenticationTestCase.java b/test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/authentication/AuthenticationTestCase.java similarity index 100% rename from test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/authentication/AuthenticationTestCase.java rename to test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/authentication/AuthenticationTestCase.java diff --git a/test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/crosscontext/CrossContextTestCase.java b/test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/crosscontext/CrossContextTestCase.java similarity index 100% rename from test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/crosscontext/CrossContextTestCase.java rename to test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/crosscontext/CrossContextTestCase.java diff --git a/test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/deployment/DeploymentTestCase.java b/test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/deployment/DeploymentTestCase.java similarity index 100% rename from test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/deployment/DeploymentTestCase.java rename to test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/deployment/DeploymentTestCase.java diff --git a/test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/deployment/RedeployServiceTestCase.java b/test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/deployment/RedeployServiceTestCase.java similarity index 100% rename from test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/deployment/RedeployServiceTestCase.java rename to test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/deployment/RedeployServiceTestCase.java diff --git a/test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/requestdispatch/RequestDispatchTestCase.java b/test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/requestdispatch/RequestDispatchTestCase.java similarity index 100% rename from test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/requestdispatch/RequestDispatchTestCase.java rename to test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/requestdispatch/RequestDispatchTestCase.java diff --git a/test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/servletlistener/ServletListenerTestCase.java b/test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/servletlistener/ServletListenerTestCase.java similarity index 100% rename from test/servers/tomcat8/src/test/java/org/gatein/wci/test/tomcat/servletlistener/ServletListenerTestCase.java rename to test/servers/tomcat/src/test/java/org/gatein/wci/test/tomcat/servletlistener/ServletListenerTestCase.java diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/authentication/context.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/authentication/context.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/authentication/context.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/authentication/context.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/authentication/web.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/authentication/web.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/authentication/web.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/authentication/web.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/crosscontext/context.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/crosscontext/context.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/crosscontext/context.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/crosscontext/context.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/crosscontext/web.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/crosscontext/web.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/crosscontext/web.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/crosscontext/web.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/deployment/context.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/deployment/context.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/deployment/context.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/deployment/context.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/deployment/web.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/deployment/web.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/deployment/web.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/deployment/web.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/requestdispatch/context.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/requestdispatch/context.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/requestdispatch/context.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/requestdispatch/context.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/requestdispatch/web.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/requestdispatch/web.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/requestdispatch/web.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/requestdispatch/web.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/context.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/context.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/context.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/context.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/listener_web.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/listener_web.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/listener_web.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/listener_web.xml diff --git a/test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/web.xml b/test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/web.xml similarity index 100% rename from test/servers/tomcat8/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/web.xml rename to test/servers/tomcat/src/test/resources/org/gatein/wci/test/tomcat/servletlistener/web.xml diff --git a/wci/src/main/java/org/gatein/wci/command/CommandServlet.java b/wci/src/main/java/org/gatein/wci/command/CommandServlet.java index 1f0a87e85..f1aa1d0ad 100644 --- a/wci/src/main/java/org/gatein/wci/command/CommandServlet.java +++ b/wci/src/main/java/org/gatein/wci/command/CommandServlet.java @@ -31,7 +31,9 @@ import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.MappingMatch; /** * This servlet is used to execute command coming from another context through a dispatching request. The invocation is @@ -82,7 +84,11 @@ static Object include( { localCmd.set(callback); RequestDispatcher switcher = targetContext.getRequestDispatcher(servletPath); - switcher.include(request, response); + switcher.include(new HttpServletRequestWrapper(request) { + public String getContextPath() { + return targetContext.getContextPath(); + } + }, response); // Throwable throwable = localThrowable.get();