diff --git a/.gitignore b/.gitignore
index 907b7ddc143..12ab1b6945c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,3 +35,6 @@ target/
# merge tooling
*.orig
+
+#maven
+*.versionsBackup
diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml
index 63a378157e9..3eb95b0ea27 100644
--- a/example-jetty-embedded/pom.xml
+++ b/example-jetty-embedded/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
example-jetty-embedded
diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/DumpServlet.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/DumpServlet.java
new file mode 100644
index 00000000000..25a0985a59c
--- /dev/null
+++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/DumpServlet.java
@@ -0,0 +1,44 @@
+// ========================================================================
+// Copyright (c) 2009-2009 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+
+
+package org.eclipse.jetty.embedded;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@SuppressWarnings("serial")
+public class DumpServlet extends HttpServlet
+{
+ public DumpServlet()
+ {
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ response.setContentType("text/html");
+ response.setStatus(HttpServletResponse.SC_OK);
+ response.getWriter().println("
DumpServlet
");
+ response.getWriter().println("requestURI=" + request.getRequestURI());
+ response.getWriter().println("contextPath=" + request.getContextPath());
+ response.getWriter().println("servletPath=" + request.getServletPath());
+ response.getWriter().println("pathInfo=" + request.getPathInfo());
+ response.getWriter().println("session=" + request.getSession(true).getId());
+ response.getWriter().println("
");
+ }
+}
\ No newline at end of file
diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/HelloServlet.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/HelloServlet.java
index 76b201e82ed..53c02f57874 100644
--- a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/HelloServlet.java
+++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/HelloServlet.java
@@ -40,7 +40,6 @@ public class HelloServlet extends HttpServlet
{
response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK);
- response.getWriter().println("" + greeting + " SimpleServlet
");
- response.getWriter().println("session=" + request.getSession(true).getId());
+ response.getWriter().println("" + greeting + " from HelloServlet
");
}
}
\ No newline at end of file
diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml
index 441fe8c0435..072ff23321e 100644
--- a/jetty-aggregate/jetty-all-server/pom.xml
+++ b/jetty-aggregate/jetty-all-server/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.aggregate
jetty-aggregate-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-all-server
diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml
index 4b55a5c9f38..3a6eee3ac51 100644
--- a/jetty-aggregate/jetty-all/pom.xml
+++ b/jetty-aggregate/jetty-all/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.aggregate
jetty-aggregate-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-all
diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml
index 4b6a1f5af70..e30ee5b160a 100644
--- a/jetty-aggregate/jetty-client/pom.xml
+++ b/jetty-aggregate/jetty-client/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.aggregate
jetty-aggregate-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-client
diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml
index 6b2dc68292e..ff9bf1f74c9 100644
--- a/jetty-aggregate/jetty-plus/pom.xml
+++ b/jetty-aggregate/jetty-plus/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.aggregate
jetty-aggregate-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-plus
diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml
index 4c6b9559b3d..8d3cdddcb2f 100644
--- a/jetty-aggregate/jetty-server/pom.xml
+++ b/jetty-aggregate/jetty-server/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.aggregate
jetty-aggregate-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-server
diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml
index b84dfefaafc..2e4f9bd47ee 100644
--- a/jetty-aggregate/jetty-servlet/pom.xml
+++ b/jetty-aggregate/jetty-servlet/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.aggregate
jetty-aggregate-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-servlet
diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml
index b01f1aae5b1..47090b07d8f 100644
--- a/jetty-aggregate/jetty-webapp/pom.xml
+++ b/jetty-aggregate/jetty-webapp/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.aggregate
jetty-aggregate-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-webapp
diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml
index 982d2884229..c650ef55103 100644
--- a/jetty-aggregate/jetty-websocket/pom.xml
+++ b/jetty-aggregate/jetty-websocket/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.aggregate
jetty-aggregate-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-websocket
diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml
index 9cda62492f4..7de1ac8d379 100644
--- a/jetty-aggregate/pom.xml
+++ b/jetty-aggregate/pom.xml
@@ -4,7 +4,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
org.eclipse.jetty.aggregate
jetty-aggregate-project
diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml
index 7ebc0f51cbf..c02155bea81 100644
--- a/jetty-ajp/pom.xml
+++ b/jetty-ajp/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-ajp
diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml
index 2e804956dd7..a4b6c219f44 100644
--- a/jetty-annotations/pom.xml
+++ b/jetty-annotations/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-annotations
diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml
index a273af541a7..02a0320bdd9 100644
--- a/jetty-client/pom.xml
+++ b/jetty-client/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml
index 2ce99f97153..6c4c47b893a 100644
--- a/jetty-continuation/pom.xml
+++ b/jetty-continuation/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-continuation
diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml
index f8e1e59c5b7..528e7ce46c0 100644
--- a/jetty-deploy/pom.xml
+++ b/jetty-deploy/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-deploy
diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml
index 9a86af25c46..173d546d426 100644
--- a/jetty-distribution/pom.xml
+++ b/jetty-distribution/pom.xml
@@ -3,7 +3,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
jetty-distribution
Jetty :: Distribution Assemblies
diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml
index 0ce5763e4a7..cf4900757c7 100644
--- a/jetty-http-spi/pom.xml
+++ b/jetty-http-spi/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-http-spi
diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml
index e6674c7abb9..48de7f48335 100644
--- a/jetty-http/pom.xml
+++ b/jetty-http/pom.xml
@@ -2,7 +2,7 @@
jetty-project
org.eclipse.jetty
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-http
diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml
index 4787cd47913..548bab2f30a 100644
--- a/jetty-io/pom.xml
+++ b/jetty-io/pom.xml
@@ -2,7 +2,7 @@
jetty-project
org.eclipse.jetty
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-io
diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml
index 483f5858e6b..f06938ce0f8 100644
--- a/jetty-jaspi/pom.xml
+++ b/jetty-jaspi/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-jaspi
diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml
index 97429c3d95b..4b9a0dc2a9d 100644
--- a/jetty-jmx/pom.xml
+++ b/jetty-jmx/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-jmx
diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml
index d8c9b642534..2a37fb7f390 100644
--- a/jetty-jndi/pom.xml
+++ b/jetty-jndi/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-jndi
diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml
index d291d3cc4d4..bfff477df54 100644
--- a/jetty-monitor/pom.xml
+++ b/jetty-monitor/pom.xml
@@ -19,7 +19,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-monitor
diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml
index 9f69eb645bd..40da79b3cfe 100644
--- a/jetty-nested/pom.xml
+++ b/jetty-nested/pom.xml
@@ -4,7 +4,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
jetty-nested
Jetty :: Nested
diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml
index 7e747ab3f8f..43b99da8fe2 100644
--- a/jetty-nosql/pom.xml
+++ b/jetty-nosql/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-nosql
diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml
index 010a41204d4..aed5c0202e0 100644
--- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml
+++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.osgi
jetty-osgi-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
../pom.xml
4.0.0
diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml
index 7084874f75d..98a73a0ce47 100644
--- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml
+++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.osgi
jetty-osgi-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
../pom.xml
4.0.0
diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml
index ae393ea6ea5..24e2cc919fa 100644
--- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml
+++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.osgi
jetty-osgi-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
../pom.xml
4.0.0
diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml
index c47b02c0db4..43ce529208f 100644
--- a/jetty-osgi/jetty-osgi-boot/pom.xml
+++ b/jetty-osgi/jetty-osgi-boot/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.osgi
jetty-osgi-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
../pom.xml
4.0.0
diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml
index b59c40c8d45..665b3af9679 100644
--- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml
+++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.osgi
jetty-osgi-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
../pom.xml
4.0.0
diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml
index f3cf6877ee8..cb8f9d76281 100644
--- a/jetty-osgi/jetty-osgi-httpservice/pom.xml
+++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.osgi
jetty-osgi-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
../pom.xml
4.0.0
diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml
index 99ae8c07307..ae30fdd313e 100644
--- a/jetty-osgi/pom.xml
+++ b/jetty-osgi/pom.xml
@@ -3,7 +3,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
../pom.xml
org.eclipse.jetty.osgi
diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml
index 1f79108cdc9..eedcb97f358 100644
--- a/jetty-osgi/test-jetty-osgi/pom.xml
+++ b/jetty-osgi/test-jetty-osgi/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty.osgi
jetty-osgi-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
../pom.xml
4.0.0
diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml
index 3f1330f3571..75b8349308e 100644
--- a/jetty-overlay-deployer/pom.xml
+++ b/jetty-overlay-deployer/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-overlay-deployer
diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml
index a2a6f2c65ef..391eb9691c7 100644
--- a/jetty-plus/pom.xml
+++ b/jetty-plus/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-plus
diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml
index fc2930ec6f6..192234b2626 100644
--- a/jetty-policy/pom.xml
+++ b/jetty-policy/pom.xml
@@ -3,7 +3,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
jetty-policy
Jetty :: Policy Tool
diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml
index 8717dc55032..cdfe6d1c5b0 100644
--- a/jetty-rewrite/pom.xml
+++ b/jetty-rewrite/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-rewrite
diff --git a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RegexTargetHandler.java b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RegexTargetHandler.java
new file mode 100644
index 00000000000..736f8245f9f
--- /dev/null
+++ b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RegexTargetHandler.java
@@ -0,0 +1,149 @@
+package org.eclipse.jetty.rewrite.handler;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.server.handler.ContextHandler.Context;
+import org.eclipse.jetty.server.handler.ScopedHandler;
+import org.eclipse.jetty.util.component.AggregateLifeCycle;
+import org.eclipse.jetty.util.log.Log;
+import org.eclipse.jetty.util.log.Logger;
+
+
+/* ------------------------------------------------------------ */
+/** A handle that uses regular expressions to select the target.
+ *
+ * This handler applies a list of regex to target name mappings to the URIs of requests.
+ * If the regex matches the URI, then the mapped target name is used in the nested
+ * call to {@link #doScope(String, Request, HttpServletRequest, HttpServletResponse)}.
+ *
+ * This handler should be installed as the first handler in a Context. It can be configured
+ * either with direct calls to {@link #addPatternTarget(String, String)} or by setting
+ * the context init parameters "org.eclipse.jetty.rewrite.handler.REGEX_MAPPINGS" to a comma
+ * separated list of strings in the format regex==target.
+ */
+public class RegexTargetHandler extends ScopedHandler
+{
+ private final static Logger LOG = Log.getLogger(RegexTargetHandler.class);
+ public final static String REGEX_MAPPINGS="org.eclipse.jetty.rewrite.handler.REGEX_MAPPINGS";
+ static class RegexMapping
+ {
+ RegexMapping(String regex,String target)
+ {
+ _pattern=Pattern.compile(regex);
+ _target=target;
+ }
+ final Pattern _pattern;
+ final String _target;
+
+ public String toString()
+ {
+ return _pattern+"=="+_target;
+ }
+ }
+
+ final private List _patterns = new CopyOnWriteArrayList();
+
+ /* ------------------------------------------------------------ */
+ /** Add a pattern to target mapping.
+ * @param pattern The regular expression pattern to match.
+ * @param target The target (normally servlet name) to handle the request
+ */
+ public void addPatternTarget(String pattern,String target)
+ {
+ _patterns.add(new RegexMapping(pattern,target));
+ }
+
+ /* ------------------------------------------------------------ */
+ @Override
+ protected void doStart() throws Exception
+ {
+ super.doStart();
+
+ Context context = ContextHandler.getCurrentContext();
+ if (context!=null)
+ {
+ String config=context.getInitParameter(REGEX_MAPPINGS);
+ LOG.debug("{}={}",REGEX_MAPPINGS,config);
+ String[] mappings=config.split("\\s*,\\s*");
+ for (String mapping : mappings)
+ {
+ mapping=mapping.trim();
+ String[] parts=mapping.split("\\s*==\\s*");
+ if (parts.length==2)
+ {
+ String pattern=parts[0];
+ String target=parts[1];
+ addPatternTarget(pattern,target);
+ }
+ else
+ LOG.warn("Bad regex mapping: "+mapping);
+ }
+ }
+ }
+
+ /* ------------------------------------------------------------ */
+ @Override
+ public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+ {
+ for (RegexTargetHandler.RegexMapping rm : _patterns)
+ {
+ Matcher m=rm._pattern.matcher(target);
+ if (m.matches())
+ {
+ String new_target = rm._target;
+ final String sp;
+ final String pi;
+
+ if (m.groupCount()==1&&target.endsWith(m.group(1)))
+ {
+ pi=m.group(1);
+ sp=target.substring(0,target.length()-pi.length());
+ }
+ else
+ {
+ sp=target;
+ pi=null;
+ }
+ baseRequest.setServletPath(sp);
+ baseRequest.setPathInfo(pi);
+ baseRequest.setAttribute("org.eclipse.jetty.servlet.REGEX_PATH",target);
+ super.nextScope(new_target,baseRequest,request,response);
+ return;
+ }
+ }
+ super.nextScope(target,baseRequest,request,response);
+ }
+
+ /* ------------------------------------------------------------ */
+ @Override
+ public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+ {
+ String path=(String)baseRequest.getAttribute("org.eclipse.jetty.servlet.REGEX_PATH");
+ if (path==null)
+ path=target;
+ else
+ baseRequest.setAttribute("org.eclipse.jetty.servlet.REGEX_PATH",null);
+
+ super.nextHandle(path,baseRequest,request,response);
+ }
+
+ /* ------------------------------------------------------------ */
+ public void dump(Appendable out, String indent) throws IOException
+ {
+ AggregateLifeCycle.dumpObject(out,this);
+ AggregateLifeCycle.dump(out,indent,_patterns,Collections.singletonList(getHandler()));
+ }
+
+
+}
\ No newline at end of file
diff --git a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/RegexTargetHandlerTest.java b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/RegexTargetHandlerTest.java
new file mode 100644
index 00000000000..c47937621df
--- /dev/null
+++ b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/RegexTargetHandlerTest.java
@@ -0,0 +1,214 @@
+// ========================================================================
+// Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+
+package org.eclipse.jetty.rewrite.handler;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.Socket;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequestWrapper;
+import javax.servlet.ServletResponseWrapper;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+import junit.framework.Assert;
+
+import org.eclipse.jetty.rewrite.handler.RegexTargetHandler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RegexTargetHandlerTest
+{
+ private static Server __server = new Server(0);
+ private static int __port;
+
+ @BeforeClass
+ public static void setup() throws Exception
+ {
+
+ ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
+ context.setContextPath("/");
+ __server.setHandler(context);
+
+ // Serve some hello world servlets
+ context.addServlet(DispatchServletServlet.class,"/dispatch/*");
+ context.addServlet(new ServletHolder("HelloAll",new HelloServlet("Hello World")),"/*");
+ context.addServlet(new ServletHolder("Italian",new HelloServlet("Buongiorno Mondo")),"/it/*");
+ context.addServlet(new ServletHolder("French", new HelloServlet("Bonjour le Monde")),"/fr/*");
+
+ RegexTargetHandler regexHandler=new RegexTargetHandler();
+ regexHandler.setHandler(context.getHandler());
+ context.setHandler(regexHandler);
+
+ context.getInitParams().put(RegexTargetHandler.REGEX_MAPPINGS,
+ " .*\\.fr==French, \n"+
+ "/ciao(/.*)$==Italian");
+
+ __server.start();
+
+ __port=__server.getConnectors()[0].getLocalPort();
+ }
+
+ @AfterClass
+ public static void shutdown() throws Exception
+ {
+ __server.stop();
+ }
+
+
+ @Test
+ public void testNormal() throws Exception
+ {
+ String[] response=getResponse("/normal");
+ assertEquals("HTTP/1.1 200 OK",response[0]);
+ assertEquals("Hello World",response[1]);
+ assertEquals("",response[2]);
+ assertEquals("/normal",response[3]);
+
+ response=getResponse("/it/info");
+ assertEquals("HTTP/1.1 200 OK",response[0]);
+ assertEquals("Buongiorno Mondo",response[1]);
+ assertEquals("/it",response[2]);
+ assertEquals("/info",response[3]);
+ }
+
+ @Test
+ public void testFullMatch() throws Exception
+ {
+ String[] response=getResponse("/some/thing.fr");
+ assertEquals("HTTP/1.1 200 OK",response[0]);
+ assertEquals("Bonjour le Monde",response[1]);
+ assertEquals("/some/thing.fr",response[2]);
+ assertEquals("null",response[3]);
+ }
+
+ @Test
+ public void testCaptureMatch() throws Exception
+ {
+ String[] response=getResponse("/ciao/info");
+ assertEquals("HTTP/1.1 200 OK",response[0]);
+ assertEquals("Buongiorno Mondo",response[1]);
+ assertEquals("/ciao",response[2]);
+ assertEquals("/info",response[3]);
+ }
+
+ @Test
+ public void testDispatchFullMatch() throws Exception
+ {
+ String[] response=getResponse("/dispatch/xxx?forward=/some/thing.fr");
+ assertEquals("HTTP/1.1 200 OK",response[0]);
+ assertEquals("Bonjour le Monde",response[1]);
+ assertEquals("/some/thing.fr",response[2]);
+ assertEquals("null",response[3]);
+ }
+
+ @Test
+ public void testDispatchCaptureMatch() throws Exception
+ {
+ String[] response=getResponse("/dispatch/xxx?forward=/ciao/info");
+ assertEquals("HTTP/1.1 200 OK",response[0]);
+ assertEquals("Buongiorno Mondo",response[1]);
+ assertEquals("/ciao",response[2]);
+ assertEquals("/info",response[3]);
+ }
+
+
+ private String[] getResponse(String uri) throws Exception
+ {
+ Socket socket = new Socket("127.0.0.1",__port);
+
+ PrintWriter out = new PrintWriter(socket.getOutputStream());
+ out.print("GET "+uri+" HTTP/1.0\r\n\r\n");
+ out.flush();
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+
+ String[] response=new String[4];
+ response[0]=in.readLine();
+ //System.err.println(response[0]);
+
+ String line=in.readLine();
+ while(line.length()>0)
+ line=in.readLine();
+
+ response[1]=in.readLine();
+ //System.err.println(response[1]);
+ response[2]=in.readLine();
+ //System.err.println(response[2]);
+ response[3]=in.readLine();
+ //System.err.println(response[3]);
+
+ socket.close();
+ return response;
+ }
+
+
+ public static class HelloServlet extends HttpServlet implements Servlet
+ {
+ final String _hello;
+
+ public HelloServlet(String hello)
+ {
+ _hello=hello;
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ response.setStatus(200);
+ response.getWriter().println(_hello);
+ response.getWriter().println(request.getServletPath());
+ response.getWriter().println(request.getPathInfo());
+ }
+ }
+
+
+ public static class DispatchServletServlet extends HttpServlet implements Servlet
+ {
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ RequestDispatcher dispatcher = null;
+
+ if(request.getParameter("include")!=null)
+ {
+ dispatcher = getServletContext().getRequestDispatcher(request.getParameter("include"));
+ dispatcher.include(new HttpServletRequestWrapper(request), new HttpServletResponseWrapper(response));
+ }
+ else if(request.getParameter("forward")!=null)
+ {
+ dispatcher = getServletContext().getRequestDispatcher(request.getParameter("forward"));
+ dispatcher.forward(new HttpServletRequestWrapper(request), new HttpServletResponseWrapper(response));
+ }
+
+ }
+ }
+}
diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml
index 5a09732e232..397991f6299 100644
--- a/jetty-security/pom.xml
+++ b/jetty-security/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-security
diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java
index da34f2d6337..f6af0978805 100644
--- a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java
+++ b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java
@@ -469,7 +469,8 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
{
Authentication.User userAuth = (Authentication.User)authentication;
baseRequest.setAuthentication(authentication);
- previousIdentity = _identityService.associate(userAuth.getUserIdentity());
+ if (_identityService!=null)
+ previousIdentity = _identityService.associate(userAuth.getUserIdentity());
if (isAuthMandatory)
{
@@ -483,7 +484,8 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
}
handler.handle(pathInContext, baseRequest, request, response);
- authenticator.secureResponse(request, response, isAuthMandatory, userAuth);
+ if (authenticator!=null)
+ authenticator.secureResponse(request, response, isAuthMandatory, userAuth);
}
else if (authentication instanceof Authentication.Deferred)
{
diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml
index 03273f40bfe..2b0dfa41526 100644
--- a/jetty-server/pom.xml
+++ b/jetty-server/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-server
diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml
index 609a94dc28f..70ab5daf8a3 100644
--- a/jetty-servlet/pom.xml
+++ b/jetty-servlet/pom.xml
@@ -3,7 +3,7 @@
jetty-project
org.eclipse.jetty
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-servlet
diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java
index 59299c608c4..2448ad29cf6 100644
--- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java
+++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java
@@ -81,7 +81,17 @@ public class ServletHolder extends Holder implements UserIdentity.Scope
public ServletHolder()
{
}
+
+ /* ---------------------------------------------------------------- */
+ /** Constructor for existing servlet.
+ */
+ public ServletHolder(String name,Servlet servlet)
+ {
+ setName(name);
+ setServlet(servlet);
+ }
+
/* ---------------------------------------------------------------- */
/** Constructor for existing servlet.
@@ -92,7 +102,16 @@ public class ServletHolder extends Holder implements UserIdentity.Scope
}
/* ---------------------------------------------------------------- */
- /** Constructor for existing servlet.
+ /** Constructor for servlet class.
+ */
+ public ServletHolder(String name,Class extends Servlet> servlet)
+ {
+ setName(name);
+ setHeldClass(servlet);
+ }
+
+ /* ---------------------------------------------------------------- */
+ /** Constructor for servlet class.
*/
public ServletHolder(Class extends Servlet> servlet)
{
diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DispatcherTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DispatcherTest.java
index b17796f0d4d..6aede63657e 100644
--- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DispatcherTest.java
+++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DispatcherTest.java
@@ -344,11 +344,16 @@ public class DispatcherTest
RequestDispatcher dispatcher = null;
if(request.getParameter("include")!=null)
+ {
dispatcher = getServletContext().getRequestDispatcher(request.getParameter("include"));
+ dispatcher.include(new ServletRequestWrapper(request), new ServletResponseWrapper(response));
+ }
else if(request.getParameter("forward")!=null)
+ {
dispatcher = getServletContext().getRequestDispatcher(request.getParameter("forward"));
+ dispatcher.forward(new ServletRequestWrapper(request), new ServletResponseWrapper(response));
+ }
- dispatcher.forward(new ServletRequestWrapper(request), new ServletResponseWrapper(response));
}
}
diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml
index 3e2982199c3..9e112abff9e 100644
--- a/jetty-servlets/pom.xml
+++ b/jetty-servlets/pom.xml
@@ -3,7 +3,7 @@
jetty-project
org.eclipse.jetty
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-servlets
diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml
index 52964c5b6b4..7d622d115e6 100644
--- a/jetty-start/pom.xml
+++ b/jetty-start/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-start
diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml
index 496c5863221..9e5dc45445a 100644
--- a/jetty-util/pom.xml
+++ b/jetty-util/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-util
diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml
index fe53e3d3ede..eb1971c5043 100644
--- a/jetty-webapp/pom.xml
+++ b/jetty-webapp/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-webapp
diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml
index a4bb91a3781..cfb4b91e581 100644
--- a/jetty-websocket/pom.xml
+++ b/jetty-websocket/pom.xml
@@ -3,7 +3,7 @@
jetty-project
org.eclipse.jetty
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml
index ac7e26faf70..b2a39954309 100644
--- a/jetty-xml/pom.xml
+++ b/jetty-xml/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
jetty-xml
diff --git a/pom.xml b/pom.xml
index 2b3c38f75c8..63315d4c21c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
19
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
Jetty :: Project
${jetty.url}
pom
diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml
index 8ea3c705b0c..498bf751457 100644
--- a/test-continuation/pom.xml
+++ b/test-continuation/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
test-continuation
diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml
index f69edcd1124..2f5b334f991 100644
--- a/test-jetty-nested/pom.xml
+++ b/test-jetty-nested/pom.xml
@@ -4,7 +4,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
test-jetty-nested
Jetty :: Nested Test
diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml
index 1d04833257f..65f98aa0f62 100644
--- a/test-jetty-servlet/pom.xml
+++ b/test-jetty-servlet/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
test-jetty-servlet
diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml
index b9806477a55..4162b96e66e 100644
--- a/test-jetty-webapp/pom.xml
+++ b/test-jetty-webapp/pom.xml
@@ -2,7 +2,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
test-jetty-webapp
diff --git a/tests/pom.xml b/tests/pom.xml
index a2aa610a515..28cee13d78b 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -21,7 +21,7 @@
org.eclipse.jetty
jetty-project
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
org.eclipse.jetty.tests
tests-parent
diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml
index 1f2b2f8d381..90bc814ddd0 100644
--- a/tests/test-integration/pom.xml
+++ b/tests/test-integration/pom.xml
@@ -20,7 +20,7 @@
org.eclipse.jetty.tests
tests-parent
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
4.0.0
test-integration
diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml
index 89716a6272f..a5e08c91017 100644
--- a/tests/test-loginservice/pom.xml
+++ b/tests/test-loginservice/pom.xml
@@ -21,7 +21,7 @@
org.eclipse.jetty.tests
tests-parent
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
test-loginservice
Jetty Tests :: Login Service
diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml
index d3db7956f0a..8c829fa6935 100644
--- a/tests/test-sessions/pom.xml
+++ b/tests/test-sessions/pom.xml
@@ -21,7 +21,7 @@
org.eclipse.jetty.tests
tests-parent
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
test-sessions-parent
Jetty Tests :: Sessions :: Parent
diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml
index 98c15fd029c..1152f8a40e2 100644
--- a/tests/test-sessions/test-hash-sessions/pom.xml
+++ b/tests/test-sessions/test-hash-sessions/pom.xml
@@ -21,7 +21,7 @@
org.eclipse.jetty.tests
test-sessions-parent
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
test-hash-sessions
Jetty Tests :: Sessions :: Hash
diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml
index ad0f5aeb5f1..567cfad6daa 100644
--- a/tests/test-sessions/test-jdbc-sessions/pom.xml
+++ b/tests/test-sessions/test-jdbc-sessions/pom.xml
@@ -21,7 +21,7 @@
org.eclipse.jetty.tests
test-sessions-parent
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
test-jdbc-sessions
Jetty Tests :: Sessions :: JDBC
diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml
index 7d5b892e93d..2979f679288 100644
--- a/tests/test-sessions/test-sessions-common/pom.xml
+++ b/tests/test-sessions/test-sessions-common/pom.xml
@@ -21,7 +21,7 @@
org.eclipse.jetty.tests
test-sessions-parent
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
test-sessions-common
Jetty Tests :: Sessions :: Common
diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml
index 26f83f052ce..c34dda4cdc9 100644
--- a/tests/test-webapps/pom.xml
+++ b/tests/test-webapps/pom.xml
@@ -21,7 +21,7 @@
org.eclipse.jetty.tests
tests-parent
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
test-webapps-parent
Jetty Tests :: WebApps :: Parent
diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml
index 38c683a2ade..b46690368a6 100644
--- a/tests/test-webapps/test-webapp-rfc2616/pom.xml
+++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml
@@ -21,7 +21,7 @@
org.eclipse.jetty.tests
test-webapps-parent
- 7.6.1-SNAPSHOT
+ 7.6.0-SNAPSHOT
test-webapp-rfc2616
Jetty Tests :: WebApp :: RFC2616