Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2015-03-06 17:57:52 -0500
committerJoakim Erdfelt2015-03-06 17:57:52 -0500
commit130afb95358618bd4027f206f4915ea4d6d9bfff (patch)
tree2f1b1df1ffd511a455c948d767303ef6cb70addd /jetty-rewrite
parent9b5205ba40e3b605dfff96b5c9e831a419d038d2 (diff)
parentdd88d393e4aaf6b234c1dc00326941e7d34b6f92 (diff)
downloadorg.eclipse.jetty.project-130afb95358618bd4027f206f4915ea4d6d9bfff.tar.gz
org.eclipse.jetty.project-130afb95358618bd4027f206f4915ea4d6d9bfff.tar.xz
org.eclipse.jetty.project-130afb95358618bd4027f206f4915ea4d6d9bfff.zip
Merge branch 'jetty-9.2.x'
Conflicts: jetty-client/src/main/java/org/eclipse/jetty/client/LeakTrackingConnectionPool.java jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientLoadTest.java jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientUploadDuringServerShutdown.java jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/SynDataReplyDataLoadTest.java jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/TooFastClientTest.java
Diffstat (limited to 'jetty-rewrite')
-rw-r--r--jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RewriteHandler.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RewriteHandler.java b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RewriteHandler.java
index 005b24135d..fc0dfe0892 100644
--- a/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RewriteHandler.java
+++ b/jetty-rewrite/src/main/java/org/eclipse/jetty/rewrite/handler/RewriteHandler.java
@@ -19,7 +19,10 @@
package org.eclipse.jetty.rewrite.handler;
import java.io.IOException;
+import java.util.Arrays;
+import java.util.EnumSet;
+import javax.servlet.DispatcherType;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -171,6 +174,7 @@ import org.eclipse.jetty.server.handler.HandlerWrapper;
public class RewriteHandler extends HandlerWrapper
{
private RuleContainer _rules;
+ private EnumSet<DispatcherType> _dispatchTypes = EnumSet.of(DispatcherType.REQUEST);
/* ------------------------------------------------------------ */
public RewriteHandler()
@@ -278,6 +282,23 @@ public class RewriteHandler extends HandlerWrapper
_rules.setOriginalPathAttribute(originalPathAttribute);
}
+ /* ------------------------------------------------------------ */
+ public EnumSet<DispatcherType> getDispatcherTypes()
+ {
+ return _dispatchTypes;
+ }
+
+ /* ------------------------------------------------------------ */
+ public void setDispatcherTypes(EnumSet<DispatcherType> types)
+ {
+ _dispatchTypes=EnumSet.copyOf(types);
+ }
+
+ /* ------------------------------------------------------------ */
+ public void setDispatcherTypes(DispatcherType... types)
+ {
+ _dispatchTypes=EnumSet.copyOf(Arrays.asList(types));
+ }
/* ------------------------------------------------------------ */
/* (non-Javadoc)
@@ -288,8 +309,11 @@ public class RewriteHandler extends HandlerWrapper
{
if (isStarted())
{
- String returned = _rules.matchAndApply(target, request, response);
- target = (returned == null) ? target : returned;
+ if (_dispatchTypes.contains(baseRequest.getDispatcherType()))
+ {
+ String returned = _rules.matchAndApply(target, request, response);
+ target = (returned == null) ? target : returned;
+ }
if (!baseRequest.isHandled())
super.handle(target, baseRequest, request, response);

Back to the top