Author: jawi Date: Wed Jun 25 14:55:09 2014 New Revision: 1605431 URL: http://svn.apache.org/r1605431 Log: RFC-189 / FELIX-4060:
- extended & cleaned the itest on the request dispatching; - cleanup of code duplication in ServletHandler; - fixed Maven POMs as they were b0rked somehow (incorrect artifact type). Modified: felix/sandbox/http-rfc189/api/pom.xml felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java felix/sandbox/http-rfc189/bridge/pom.xml felix/sandbox/http-rfc189/bundle/pom.xml felix/sandbox/http-rfc189/cometd/pom.xml felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java felix/sandbox/http-rfc189/jetty/pom.xml felix/sandbox/http-rfc189/parent/pom.xml felix/sandbox/http-rfc189/proxy/pom.xml felix/sandbox/http-rfc189/servlet-api/pom.xml felix/sandbox/http-rfc189/sslfilter/pom.xml felix/sandbox/http-rfc189/whiteboard/pom.xml Modified: felix/sandbox/http-rfc189/api/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/api/pom.xml (original) +++ felix/sandbox/http-rfc189/api/pom.xml Wed Jun 25 14:55:09 2014 @@ -29,7 +29,7 @@ <name>Apache Felix Http Api</name> <artifactId>org.apache.felix.http.api</artifactId> <version>3.0.0-SNAPSHOT</version> - <packaging>jar</packaging> + <packaging>bundle</packaging> <scm> <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/api</connection> @@ -42,6 +42,7 @@ <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> <configuration> <instructions> <Export-Package> Modified: felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java (original) +++ felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java Wed Jun 25 14:55:09 2014 @@ -265,16 +265,7 @@ public final class ServletHandler extend public RequestDispatcher createRequestDispatcher(String path, String pathInContext, String query) { // Determine which servletPath we should use... - String servletPath = null; - for (Pattern pattern : this.patterns) - { - Matcher m = pattern.matcher(pathInContext); - if (m.find()) - { - servletPath = m.groupCount() > 0 ? m.group(1) : m.group(); - break; - } - } + String servletPath = determineServletPath(pathInContext); return new RequestDispatcherImpl(path, servletPath, pathInContext, query); } Modified: felix/sandbox/http-rfc189/bridge/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/bridge/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/bridge/pom.xml (original) +++ felix/sandbox/http-rfc189/bridge/pom.xml Wed Jun 25 14:55:09 2014 @@ -29,7 +29,7 @@ <name>Apache Felix Http Bridge</name> <artifactId>org.apache.felix.http.bridge</artifactId> <version>3.0.0-SNAPSHOT</version> - <packaging>jar</packaging> + <packaging>bundle</packaging> <scm> <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/bridge</connection> @@ -42,6 +42,7 @@ <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> <configuration> <instructions> <Bundle-Activator> Modified: felix/sandbox/http-rfc189/bundle/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/bundle/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/bundle/pom.xml (original) +++ felix/sandbox/http-rfc189/bundle/pom.xml Wed Jun 25 14:55:09 2014 @@ -29,7 +29,7 @@ <name>Apache Felix Http Bundle</name> <artifactId>org.apache.felix.http.bundle</artifactId> <version>3.0.0-SNAPSHOT</version> - <packaging>jar</packaging> + <packaging>bundle</packaging> <scm> <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/bundle</connection> @@ -42,6 +42,7 @@ <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> <configuration> <instructions> <X-Jetty-Version> Modified: felix/sandbox/http-rfc189/cometd/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/cometd/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/cometd/pom.xml (original) +++ felix/sandbox/http-rfc189/cometd/pom.xml Wed Jun 25 14:55:09 2014 @@ -42,6 +42,7 @@ <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> <configuration> <instructions> <Bundle-Activator> Modified: felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java (original) +++ felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java Wed Jun 25 14:55:09 2014 @@ -54,12 +54,84 @@ import org.osgi.service.http.NamespaceEx @RunWith(PaxExam.class) public class RequestDispatchTest extends BaseIntegrationTest { + private static final String DEFAULT_CONTEXT_PATH = ""; + /** * Tests that we can forward content from other servlets using the {@link RequestDispatcher} service. */ @Test public void testDispatchForwardToAbsoluteURIOk() throws Exception { + doTestForwardAbsoluteURI(DEFAULT_CONTEXT_PATH, "/forward", null); + doTestForwardAbsoluteURI(DEFAULT_CONTEXT_PATH, "/forward/", null); + doTestForwardAbsoluteURI(DEFAULT_CONTEXT_PATH, "/forward", "/to/other/path"); + } + + /** + * Tests that we can forward content from other servlets using the {@link RequestDispatcher} service. + */ + @Test + public void testDispatchForwardToRelativeURIOk() throws Exception + { + doTestForwardRelativeURI(DEFAULT_CONTEXT_PATH, null); + doTestForwardRelativeURI(DEFAULT_CONTEXT_PATH, "/to/other/path"); + } + + /** + * Tests that we can include content from other servlets using the {@link RequestDispatcher} service. + */ + @Test + public void testDispatchIncludeAbsoluteURIOk() throws Exception + { + doTestIncludeAbsoluteURI(DEFAULT_CONTEXT_PATH, null); + doTestIncludeAbsoluteURI(DEFAULT_CONTEXT_PATH, "/other/content"); + } + + /** + * Tests that we can include content from other servlets using the {@link RequestDispatcher} service. + */ + @Test + public void testDispatchIncludeRelativeURIOk() throws Exception + { + doTestIncludeRelativeURI(DEFAULT_CONTEXT_PATH, null); + doTestIncludeRelativeURI(DEFAULT_CONTEXT_PATH, "/other/content"); + } + + /** + * Tests that we can forward content from other servlets using the {@link RequestDispatcher} service. + */ + @Test + public void testDispatchOnNonRootContextPathOk() throws Exception + { + // Configure HTTP on a different context path... + String contextPath = "/otherContext"; + Configuration config = configureHttpService(createDictionary("org.apache.felix.http.context_path", contextPath, "org.osgi.service.http.port", "8080")); + + try + { + // Include multiple tests in one as to keep tests a little easier to read... + doTestForwardAbsoluteURI(contextPath, "/forward", null); + doTestForwardAbsoluteURI(contextPath, "/forward/", null); + doTestIncludeAbsoluteURI(contextPath, null); + + doTestForwardAbsoluteURI(contextPath, "/forward", "/to/other/path"); + doTestIncludeAbsoluteURI(contextPath, "/other/content"); + + doTestForwardRelativeURI(contextPath, null); + doTestIncludeRelativeURI(contextPath, null); + + doTestForwardRelativeURI(contextPath, "/to/other/path"); + doTestIncludeRelativeURI(contextPath, "/other/content"); + } + finally + { + config.delete(); + } + } + + private void doTestForwardAbsoluteURI(final String contextPath, final String forwardPath, final String forwardPathSuffix) throws ServletException, NamespaceException, InterruptedException, + IOException + { CountDownLatch initLatch = new CountDownLatch(2); CountDownLatch destroyLatch = new CountDownLatch(2); @@ -70,27 +142,27 @@ public class RequestDispatchTest extends @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - Object includeContextPath = req.getAttribute(FORWARD_CONTEXT_PATH); - if (includeContextPath != null) + Object forwardContextPath = req.getAttribute(FORWARD_CONTEXT_PATH); + if (forwardContextPath != null) { - assertEquals("", req.getContextPath()); - assertEquals("/forward", req.getServletPath()); - assertEquals(null, req.getPathInfo()); - assertEquals("/forward", req.getRequestURI()); + assertEquals(contextPath, req.getContextPath()); + assertEquals(forwardPath, req.getServletPath()); + assertEquals(forwardPathSuffix, req.getPathInfo()); + assertEquals(contextPath.concat(forwardPath).concat(nvl(forwardPathSuffix)), req.getRequestURI()); assertEquals("bar=qux&quu", req.getQueryString()); - assertEquals("", includeContextPath); + assertEquals(contextPath, forwardContextPath); assertEquals("/test", req.getAttribute(FORWARD_SERVLET_PATH)); assertEquals("/foo", req.getAttribute(FORWARD_PATH_INFO)); - assertEquals("/test/foo", req.getAttribute(FORWARD_REQUEST_URI)); + assertEquals(contextPath.concat("/test/foo"), req.getAttribute(FORWARD_REQUEST_URI)); assertEquals("bar=qux&quu", req.getAttribute(FORWARD_QUERY_STRING)); } else { - assertEquals("", req.getContextPath()); - assertEquals("/forward", req.getServletPath()); + assertEquals(contextPath, req.getContextPath()); + assertEquals(forwardPath, req.getServletPath()); assertEquals("/bar", req.getPathInfo()); - assertEquals("/forward/bar", req.getRequestURI()); + assertEquals(contextPath.concat(forwardPath).concat("/bar"), req.getRequestURI()); assertEquals("quu=qux", req.getQueryString()); } @@ -105,25 +177,25 @@ public class RequestDispatchTest extends @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - assertEquals("", req.getContextPath()); + assertEquals(contextPath, req.getContextPath()); assertEquals("/test", req.getServletPath()); assertEquals("/foo", req.getPathInfo()); - assertEquals("/test/foo", req.getRequestURI()); + assertEquals(contextPath.concat("/test/foo"), req.getRequestURI()); assertEquals("bar=qux&quu", req.getQueryString()); resp.getWriter().println("NOT_SEND"); - req.getRequestDispatcher("/forward").forward(req, resp); + req.getRequestDispatcher(forwardPath.concat(nvl(forwardPathSuffix))).forward(req, resp); resp.getWriter().println("NOT_SEND"); } }; - register("/forward", forward); + register(forwardPath, forward); register("/test", servlet); assertTrue(initLatch.await(5, TimeUnit.SECONDS)); - assertContent("FORWARD\n", createURL("/test/foo?bar=qux&quu")); - assertContent("FORWARD\n", createURL("/forward/bar?quu=qux")); + assertContent("FORWARD\n", createURL(contextPath.concat("/test/foo?bar=qux&quu"))); + assertContent("FORWARD\n", createURL(contextPath.concat(forwardPath).concat("/bar?quu=qux"))); unregister(forward); unregister(servlet); @@ -132,10 +204,9 @@ public class RequestDispatchTest extends } /** - * Tests that we can forward content from other servlets using the {@link RequestDispatcher} service. + * Tests that we can forward requests to the same servlet using the {@link RequestDispatcher} service. */ - @Test - public void testDispatchForwardToRelativeURIOk() throws Exception + private void doTestForwardRelativeURI(final String contextPath, final String forwardPathSuffix) throws ServletException, NamespaceException, InterruptedException, IOException { CountDownLatch initLatch = new CountDownLatch(1); CountDownLatch destroyLatch = new CountDownLatch(1); @@ -150,35 +221,35 @@ public class RequestDispatchTest extends Object contextPathAttr = req.getAttribute(FORWARD_CONTEXT_PATH); if (contextPathAttr != null) { - assertEquals("", req.getContextPath()); + assertEquals(contextPath, req.getContextPath()); assertEquals("/test", req.getServletPath()); - assertEquals("/forward", req.getPathInfo()); - assertEquals("/test/forward", req.getRequestURI()); + assertEquals("/forward".concat(nvl(forwardPathSuffix)), req.getPathInfo()); + assertEquals(contextPath.concat("/test/forward").concat(nvl(forwardPathSuffix)), req.getRequestURI()); assertEquals("bar=qux&quu", req.getQueryString()); - assertEquals("", contextPathAttr); + assertEquals(contextPath, contextPathAttr); assertEquals("/test", req.getAttribute(FORWARD_SERVLET_PATH)); assertEquals("/foo", req.getAttribute(FORWARD_PATH_INFO)); - assertEquals("/test/foo", req.getAttribute(FORWARD_REQUEST_URI)); + assertEquals(contextPath.concat("/test/foo"), req.getAttribute(FORWARD_REQUEST_URI)); assertEquals("bar=qux&quu", req.getAttribute(FORWARD_QUERY_STRING)); resp.getWriter().println("FORWARD"); } else { - assertEquals("", req.getContextPath()); + assertEquals(contextPath, req.getContextPath()); assertEquals("/test", req.getServletPath()); assertEquals("/foo", req.getPathInfo()); - assertEquals("/test/foo", req.getRequestURI()); + assertEquals(contextPath.concat("/test/foo"), req.getRequestURI()); assertEquals("bar=qux&quu", req.getQueryString()); resp.getWriter().println("NOT_SEND"); // ServletContext#getRequestDispatcher only takes absolute paths... - RequestDispatcher disp = req.getServletContext().getRequestDispatcher("forward"); + RequestDispatcher disp = req.getServletContext().getRequestDispatcher("forward".concat(nvl(forwardPathSuffix))); assertNull("ServletContext returned RequestDispatcher for relative path?!", disp); // Causes a request to ourselves being made (/test/forward)... - disp = req.getRequestDispatcher("forward"); + disp = req.getRequestDispatcher("forward".concat(nvl(forwardPathSuffix))); assertNotNull("ServletRequest returned NO RequestDispatcher for relative path?!", disp); disp.forward(req, resp); @@ -191,7 +262,7 @@ public class RequestDispatchTest extends assertTrue(initLatch.await(5, TimeUnit.SECONDS)); - assertContent("FORWARD\n", createURL("/test/foo?bar=qux&quu")); + assertContent("FORWARD\n", createURL(contextPath.concat("/test/foo?bar=qux&quu"))); unregister(servlet); @@ -201,8 +272,7 @@ public class RequestDispatchTest extends /** * Tests that we can include content from other servlets using the {@link RequestDispatcher} service. */ - @Test - public void testDispatchIncludeAbsoluteURIOk() throws Exception + private void doTestIncludeAbsoluteURI(final String contextPath, final String includePathSuffix) throws Exception { CountDownLatch initLatch = new CountDownLatch(2); CountDownLatch destroyLatch = new CountDownLatch(2); @@ -217,24 +287,24 @@ public class RequestDispatchTest extends Object includeContextPath = req.getAttribute(INCLUDE_CONTEXT_PATH); if (includeContextPath != null) { - assertEquals("", req.getContextPath()); + assertEquals(contextPath, req.getContextPath()); assertEquals("/test", req.getServletPath()); assertEquals("/foo", req.getPathInfo()); - assertEquals("/test/foo", req.getRequestURI()); + assertEquals(contextPath.concat("/test/foo"), req.getRequestURI()); assertEquals("bar=qux&quu", req.getQueryString()); - assertEquals("", includeContextPath); + assertEquals(contextPath, includeContextPath); assertEquals("/include", req.getAttribute(INCLUDE_SERVLET_PATH)); - assertEquals(null, req.getAttribute(INCLUDE_PATH_INFO)); - assertEquals("/include", req.getAttribute(INCLUDE_REQUEST_URI)); + assertEquals(includePathSuffix, req.getAttribute(INCLUDE_PATH_INFO)); + assertEquals(contextPath.concat("/include").concat(nvl(includePathSuffix)), req.getAttribute(INCLUDE_REQUEST_URI)); assertEquals(null, req.getAttribute(INCLUDE_QUERY_STRING)); } else { - assertEquals("", req.getContextPath()); + assertEquals(contextPath, req.getContextPath()); assertEquals("/include", req.getServletPath()); assertEquals("/bar", req.getPathInfo()); - assertEquals("/include/bar", req.getRequestURI()); + assertEquals(contextPath.concat("/include/bar"), req.getRequestURI()); assertEquals("quu=qux", req.getQueryString()); } @@ -249,14 +319,14 @@ public class RequestDispatchTest extends @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - assertEquals("", req.getContextPath()); + assertEquals(contextPath, req.getContextPath()); assertEquals("/test", req.getServletPath()); assertEquals("/foo", req.getPathInfo()); - assertEquals("/test/foo", req.getRequestURI()); + assertEquals(contextPath.concat("/test/foo"), req.getRequestURI()); assertEquals("bar=qux&quu", req.getQueryString()); resp.getWriter().println("BEFORE"); - req.getRequestDispatcher("/include").include(req, resp); + req.getRequestDispatcher("/include".concat(nvl(includePathSuffix))).include(req, resp); resp.getWriter().println("AFTER"); } }; @@ -266,8 +336,8 @@ public class RequestDispatchTest extends assertTrue(initLatch.await(5, TimeUnit.SECONDS)); - assertContent("BEFORE\nINCLUDE\nAFTER\n", createURL("/test/foo?bar=qux&quu")); - assertContent("INCLUDE\n", createURL("/include/bar?quu=qux")); + assertContent("BEFORE\nINCLUDE\nAFTER\n", createURL(contextPath.concat("/test/foo?bar=qux&quu"))); + assertContent("INCLUDE\n", createURL(contextPath.concat("/include/bar?quu=qux"))); unregister(include); unregister(servlet); @@ -276,10 +346,9 @@ public class RequestDispatchTest extends } /** - * Tests that we can include content from other servlets using the {@link RequestDispatcher} service. + * Tests that we can include content from the same servlet using the {@link RequestDispatcher} service. */ - @Test - public void testDispatchIncludeRelativeURIOk() throws Exception + private void doTestIncludeRelativeURI(final String contextPath, final String includePathSuffix) throws Exception { CountDownLatch initLatch = new CountDownLatch(1); CountDownLatch destroyLatch = new CountDownLatch(1); @@ -294,35 +363,35 @@ public class RequestDispatchTest extends Object contextPathAttr = req.getAttribute(INCLUDE_CONTEXT_PATH); if (contextPathAttr != null) { - assertEquals("", req.getContextPath()); + assertEquals(contextPath, req.getContextPath()); assertEquals("/foo", req.getPathInfo()); assertEquals("/test", req.getServletPath()); - assertEquals("/test/foo", req.getRequestURI()); + assertEquals(contextPath.concat("/test/foo"), req.getRequestURI()); assertEquals("bar=qux&quu", req.getQueryString()); - assertEquals("", contextPathAttr); + assertEquals(contextPath, contextPathAttr); assertEquals("/test", req.getAttribute(INCLUDE_SERVLET_PATH)); - // assertEquals("/include", req.getAttribute(INCLUDE_PATH_INFO)); - // assertEquals("/test/include", req.getAttribute(INCLUDE_REQUEST_URI)); + assertEquals("/include".concat(nvl(includePathSuffix)), req.getAttribute(INCLUDE_PATH_INFO)); + assertEquals(contextPath.concat("/test/include").concat(nvl(includePathSuffix)), req.getAttribute(INCLUDE_REQUEST_URI)); assertEquals(null, req.getAttribute(INCLUDE_QUERY_STRING)); resp.getWriter().println("INCLUDE"); } else { - assertEquals("", req.getContextPath()); + assertEquals(contextPath, req.getContextPath()); assertEquals("/test", req.getServletPath()); - // assertEquals("/foo", req.getPathInfo()); - // assertEquals("/test/foo", req.getRequestURI()); + assertEquals("/foo", req.getPathInfo()); + assertEquals(contextPath.concat("/test/foo"), req.getRequestURI()); assertEquals("bar=qux&quu", req.getQueryString()); resp.getWriter().println("BEFORE"); // ServletContext#getRequestDispatcher only takes absolute paths... - RequestDispatcher disp = req.getServletContext().getRequestDispatcher("include"); + RequestDispatcher disp = req.getServletContext().getRequestDispatcher("include".concat(nvl(includePathSuffix))); assertNull("ServletContext returned RequestDispatcher for relative path?!", disp); // Causes a request to ourselves being made (/test/forward)... - disp = req.getRequestDispatcher("include"); + disp = req.getRequestDispatcher("include".concat(nvl(includePathSuffix))); assertNotNull("ServletRequest returned NO RequestDispatcher for relative path?!", disp); disp.include(req, resp); @@ -335,180 +404,27 @@ public class RequestDispatchTest extends assertTrue(initLatch.await(5, TimeUnit.SECONDS)); - assertContent("BEFORE\nINCLUDE\nAFTER\n", createURL("/test/foo?bar=qux&quu")); + assertContent("BEFORE\nINCLUDE\nAFTER\n", createURL(contextPath.concat("/test/foo?bar=qux&quu"))); unregister(servlet); assertTrue(destroyLatch.await(5, TimeUnit.SECONDS)); } - /** - * Tests that we can forward content from other servlets using the {@link RequestDispatcher} service. - */ - @Test - public void testDispatchOnNonRootContextPathOk() throws Exception - { - // Configure HTTP on a different context path... - Configuration config = configureHttpService(createDictionary("org.apache.felix.http.context_path", "/context", "org.osgi.service.http.port", "8080")); - - try - { - // Include two tests in one as to keep tests a little easier to read... - doTestForwardAbsoluteURI(); - doTestIncludeAbsoluteURI(); - } - finally - { - config.delete(); - } - } - - private void doTestForwardAbsoluteURI() throws ServletException, NamespaceException, InterruptedException, IOException + private static String nvl(String... strings) { - CountDownLatch initLatch = new CountDownLatch(2); - CountDownLatch destroyLatch = new CountDownLatch(2); - - TestServlet forward = new TestServlet(initLatch, destroyLatch) - { - private static final long serialVersionUID = 1L; - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - { - Object includeContextPath = req.getAttribute(FORWARD_CONTEXT_PATH); - if (includeContextPath != null) - { - assertEquals("/context", req.getContextPath()); - assertEquals("/forward", req.getServletPath()); - assertEquals(null, req.getPathInfo()); - assertEquals("/context/forward", req.getRequestURI()); - assertEquals("bar=qux&quu", req.getQueryString()); - - assertEquals("/context", includeContextPath); - assertEquals("/test", req.getAttribute(FORWARD_SERVLET_PATH)); - assertEquals("/foo", req.getAttribute(FORWARD_PATH_INFO)); - assertEquals("/context/test/foo", req.getAttribute(FORWARD_REQUEST_URI)); - assertEquals("bar=qux&quu", req.getAttribute(FORWARD_QUERY_STRING)); - } - else - { - assertEquals("/context", req.getContextPath()); - assertEquals("/forward", req.getServletPath()); - assertEquals("/bar", req.getPathInfo()); - assertEquals("/context/forward/bar", req.getRequestURI()); - assertEquals("quu=qux", req.getQueryString()); - } - - resp.getWriter().println("FORWARD"); - } - }; - - TestServlet servlet = new TestServlet(initLatch, destroyLatch) + for (String str : strings) { - private static final long serialVersionUID = 1L; - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + if (!isEmpty(str)) { - assertEquals("/context", req.getContextPath()); - assertEquals("/test", req.getServletPath()); - assertEquals("/foo", req.getPathInfo()); - assertEquals("/context/test/foo", req.getRequestURI()); - assertEquals("bar=qux&quu", req.getQueryString()); - - resp.getWriter().println("NOT_SEND"); - req.getRequestDispatcher("/forward").forward(req, resp); - resp.getWriter().println("NOT_SEND"); + return str; } - }; - - register("/forward", forward); - register("/test", servlet); - - assertTrue(initLatch.await(5, TimeUnit.SECONDS)); - - assertContent("FORWARD\n", createURL("/context/test/foo?bar=qux&quu")); - assertContent("FORWARD\n", createURL("/context/forward/bar?quu=qux")); - - unregister(forward); - unregister(servlet); - - assertTrue(destroyLatch.await(5, TimeUnit.SECONDS)); + } + return DEFAULT_CONTEXT_PATH; } - /** - * Tests that we can include content from other servlets using the {@link RequestDispatcher} service. - */ - private void doTestIncludeAbsoluteURI() throws Exception + private static boolean isEmpty(String val) { - CountDownLatch initLatch = new CountDownLatch(2); - CountDownLatch destroyLatch = new CountDownLatch(2); - - TestServlet include = new TestServlet(initLatch, destroyLatch) - { - private static final long serialVersionUID = 1L; - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - { - Object includeContextPath = req.getAttribute(INCLUDE_CONTEXT_PATH); - if (includeContextPath != null) - { - assertEquals("/context", req.getContextPath()); - assertEquals("/test", req.getServletPath()); - assertEquals("/foo", req.getPathInfo()); - assertEquals("/context/test/foo", req.getRequestURI()); - assertEquals("bar=qux&quu", req.getQueryString()); - - assertEquals("/context", includeContextPath); - assertEquals("/include", req.getAttribute(INCLUDE_SERVLET_PATH)); - assertEquals(null, req.getAttribute(INCLUDE_PATH_INFO)); - assertEquals("/context/include", req.getAttribute(INCLUDE_REQUEST_URI)); - assertEquals(null, req.getAttribute(INCLUDE_QUERY_STRING)); - } - else - { - assertEquals("/context", req.getContextPath()); - assertEquals("/include", req.getServletPath()); - assertEquals("/bar", req.getPathInfo()); - assertEquals("/context/include/bar", req.getRequestURI()); - assertEquals("quu=qux", req.getQueryString()); - } - - resp.getWriter().println("INCLUDE"); - } - }; - - TestServlet servlet = new TestServlet(initLatch, destroyLatch) - { - private static final long serialVersionUID = 1L; - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - { - assertEquals("/context", req.getContextPath()); - assertEquals("/test", req.getServletPath()); - assertEquals("/foo", req.getPathInfo()); - assertEquals("/context/test/foo", req.getRequestURI()); - assertEquals("bar=qux&quu", req.getQueryString()); - - resp.getWriter().println("BEFORE"); - req.getRequestDispatcher("/include").include(req, resp); - resp.getWriter().println("AFTER"); - } - }; - - register("/include", include); - register("/test", servlet); - - assertTrue(initLatch.await(5, TimeUnit.SECONDS)); - - assertContent("BEFORE\nINCLUDE\nAFTER\n", createURL("/context/test/foo?bar=qux&quu")); - assertContent("INCLUDE\n", createURL("/context/include/bar?quu=qux")); - - unregister(include); - unregister(servlet); - - assertTrue(destroyLatch.await(5, TimeUnit.SECONDS)); + return val == null || DEFAULT_CONTEXT_PATH.equals(val.trim()); } } Modified: felix/sandbox/http-rfc189/jetty/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/jetty/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/jetty/pom.xml (original) +++ felix/sandbox/http-rfc189/jetty/pom.xml Wed Jun 25 14:55:09 2014 @@ -29,7 +29,7 @@ <name>Apache Felix Http Jetty</name> <artifactId>org.apache.felix.http.jetty</artifactId> <version>3.0.0-SNAPSHOT</version> - <packaging>jar</packaging> + <packaging>bundle</packaging> <scm> <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/jetty</connection> Modified: felix/sandbox/http-rfc189/parent/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/parent/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/parent/pom.xml (original) +++ felix/sandbox/http-rfc189/parent/pom.xml Wed Jun 25 14:55:09 2014 @@ -1,136 +1,120 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.felix</groupId> - <artifactId>felix-parent</artifactId> - <version>2.1</version> - <relativePath>../../pom/pom.xml</relativePath> - </parent> - - <name>Apache Felix Http Parent POM</name> - <artifactId>org.apache.felix.http.parent</artifactId> - <version>3-SNAPSHOT</version> - <packaging>pom</packaging> - - <prerequisites> - <maven>2.0.7</maven> - </prerequisites> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <jetty.version>8.1.15.v20140411</jetty.version> - <cometd.version>2.8.0</cometd.version> - <http.service.version>1.3.0</http.service.version> - <osgi.dto.version>1.0.0</osgi.dto.version> - <servlet.version>3.0.1</servlet.version> - - <http.api.version>3.0.0</http.api.version> - </properties> - - <scm> - <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/parent</connection> - <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/http/parent</developerConnection> - <url>http://svn.apache.org/viewvc/felix/trunk/http/parent/</url> - </scm> - - <build> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - <compilerVersion>1.5</compilerVersion> - </configuration> - </plugin> - </plugins> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>2.4.0</version> - <executions> - <execution> - <id>bundle</id> - <phase>package</phase> - <goals> - <goal>bundle</goal> - </goals> - </execution> - </executions> - <configuration> - <instructions> - <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> - <Bundle-Version>${project.version}</Bundle-Version> - </instructions> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.2</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.8.2</version> - <scope>test</scope> - </dependency> - </dependencies> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>${servlet.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - <version>4.2.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.compendium</artifactId> - <version>4.2.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>biz.aQute</groupId> - <artifactId>bndlib</artifactId> - <version>1.50.0</version> - <scope>provided</scope> - </dependency> - </dependencies> - </dependencyManagement> +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.felix</groupId> + <artifactId>felix-parent</artifactId> + <version>2.1</version> + <relativePath>../../pom/pom.xml</relativePath> + </parent> + + <name>Apache Felix Http Parent POM</name> + <artifactId>org.apache.felix.http.parent</artifactId> + <version>3-SNAPSHOT</version> + <packaging>pom</packaging> + + <prerequisites> + <maven>2.0.7</maven> + </prerequisites> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <jetty.version>8.1.15.v20140411</jetty.version> + <cometd.version>2.8.0</cometd.version> + <http.service.version>1.3.0</http.service.version> + <osgi.dto.version>1.0.0</osgi.dto.version> + <servlet.version>3.0.1</servlet.version> + + <http.api.version>3.0.0</http.api.version> + </properties> + + <scm> + <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/parent</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/http/parent</developerConnection> + <url>http://svn.apache.org/viewvc/felix/trunk/http/parent/</url> + </scm> + + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + <compilerVersion>1.5</compilerVersion> + </configuration> + </plugin> + </plugins> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>2.4.0</version> + <configuration> + <instructions> + <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> + <Bundle-Version>${project.version}</Bundle-Version> + </instructions> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>${servlet.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <version>4.2.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <version>4.2.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>biz.aQute</groupId> + <artifactId>bndlib</artifactId> + <version>1.50.0</version> + <scope>provided</scope> + </dependency> + </dependencies> + </dependencyManagement> </project> Modified: felix/sandbox/http-rfc189/proxy/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/proxy/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/proxy/pom.xml (original) +++ felix/sandbox/http-rfc189/proxy/pom.xml Wed Jun 25 14:55:09 2014 @@ -28,8 +28,8 @@ <name>Apache Felix Http Proxy</name> <artifactId>org.apache.felix.http.proxy</artifactId> - <version>2.3.0-SNAPSHOT</version> - <packaging>jar</packaging> + <version>3.0.0-SNAPSHOT</version> + <packaging>bundle</packaging> <scm> <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/proxy</connection> @@ -42,6 +42,7 @@ <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> <configuration> <instructions> <Export-Package> Modified: felix/sandbox/http-rfc189/servlet-api/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/servlet-api/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/servlet-api/pom.xml (original) +++ felix/sandbox/http-rfc189/servlet-api/pom.xml Wed Jun 25 14:55:09 2014 @@ -1,69 +1,69 @@ <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor - license agreements. See the NOTICE file distributed with this work for additional - information regarding copyright ownership. The ASF licenses this file to - you under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of - the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required - by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - OF ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. --> + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" -> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.http.parent</artifactId> - <version>3-SNAPSHOT</version> - <relativePath>../parent/pom.xml</relativePath> - </parent> - - <name>Apache Felix Servlet API</name> - <description>Provides the Servlet API for use by applications</description> - <artifactId>org.apache.felix.http.servlet-api</artifactId> - <version>1.0.1-SNAPSHOT</version> - <packaging>jar</packaging> - - <scm> - <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/servlet-api</connection> - <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/http/servlet-api</developerConnection> - <url>http://svn.apache.org/viewvc/felix/trunk/http/servlet-api/</url> - </scm> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - javax.servlet; - javax.servlet.annotation; - javax.servlet.descriptor; - javax.servlet.http; - version=2.6, - javax.servlet; - javax.servlet.annotation; - javax.servlet.descriptor; - javax.servlet.http; - version=3.0 - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>org.apache.tomcat</groupId> - <artifactId>tomcat-servlet-api</artifactId> - <version>7.0.8</version> - </dependency> - </dependencies> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.http.parent</artifactId> + <version>3-SNAPSHOT</version> + <relativePath>../parent/pom.xml</relativePath> + </parent> + + <name>Apache Felix Servlet API</name> + <description>Provides the Servlet API for use by applications</description> + <artifactId>org.apache.felix.http.servlet-api</artifactId> + <version>1.0.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <scm> + <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/servlet-api</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/http/servlet-api</developerConnection> + <url>http://svn.apache.org/viewvc/felix/trunk/http/servlet-api/</url> + </scm> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package> + javax.servlet; + javax.servlet.annotation; + javax.servlet.descriptor; + javax.servlet.http; + version=2.6, + javax.servlet; + javax.servlet.annotation; + javax.servlet.descriptor; + javax.servlet.http; + version=3.0 + </Export-Package> + <Embed-Dependency>tomcat-servlet-api;inline=true</Embed-Dependency> + </instructions> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>tomcat-servlet-api</artifactId> + <version>7.0.8</version> + </dependency> + </dependencies> </project> Modified: felix/sandbox/http-rfc189/sslfilter/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/sslfilter/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/sslfilter/pom.xml (original) +++ felix/sandbox/http-rfc189/sslfilter/pom.xml Wed Jun 25 14:55:09 2014 @@ -29,7 +29,7 @@ <name>Apache Felix Http SSL Filter</name> <artifactId>org.apache.felix.http.sslfilter</artifactId> <version>0.1.0-SNAPSHOT</version> - <packaging>jar</packaging> + <packaging>bundle</packaging> <scm> <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/sslfilter</connection> Modified: felix/sandbox/http-rfc189/whiteboard/pom.xml URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/pom.xml?rev=1605431&r1=1605430&r2=1605431&view=diff ============================================================================== --- felix/sandbox/http-rfc189/whiteboard/pom.xml (original) +++ felix/sandbox/http-rfc189/whiteboard/pom.xml Wed Jun 25 14:55:09 2014 @@ -29,7 +29,7 @@ <name>Apache Felix Http Whiteboard</name> <artifactId>org.apache.felix.http.whiteboard</artifactId> <version>3.0.0-SNAPSHOT</version> - <packaging>jar</packaging> + <packaging>bundle</packaging> <scm> <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/whiteboard</connection>