Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2013-07-08 03:00:03 +0000
committerGreg Wilkins2013-07-08 03:00:03 +0000
commit5ddaf9acbf5d98ad2892b6bac98a9097fff9701d (patch)
tree8c23839e357d378809890b94bb3d90a980e603a1
parent981102fda5a4ea4f728a2f9023e50dd7986bd8b7 (diff)
downloadorg.eclipse.jetty.project-5ddaf9acbf5d98ad2892b6bac98a9097fff9701d.tar.gz
org.eclipse.jetty.project-5ddaf9acbf5d98ad2892b6bac98a9097fff9701d.tar.xz
org.eclipse.jetty.project-5ddaf9acbf5d98ad2892b6bac98a9097fff9701d.zip
398467 Servlet 3.1 Non Blocking IO
Make sure that onAllDataRead is correctly dispatched
-rw-r--r--jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/CompactPathRule.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/CompactPathRule.java b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/CompactPathRule.java
new file mode 100644
index 0000000000..de041f0db5
--- /dev/null
+++ b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/CompactPathRule.java
@@ -0,0 +1,55 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 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 java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.http.HttpURI;
+import org.eclipse.jetty.http.PathMap;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.util.URIUtil;
+
+/**
+ * Rewrite the URI by compacting to remove //
+ */
+public class CompactPathRule extends Rule implements Rule.ApplyURI
+{
+ public CompactPathRule()
+ {
+ _handling = false;
+ _terminating = false;
+ }
+
+ @Override
+ public void applyURI(Request request, String oldTarget, String newTarget) throws IOException
+ {
+ request.setRequestURI(newTarget);
+ }
+
+ @Override
+ public String matchAndApply(String target, HttpServletRequest request, HttpServletResponse response) throws IOException
+ {
+ if (target.startsWith("/"))
+ return URIUtil.compactPath(target);
+ return target;
+ }
+}

Back to the top