felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r999261 - /felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java
Date Tue, 21 Sep 2010 07:54:36 GMT
Author: cziegeler
Date: Tue Sep 21 07:54:36 2010
New Revision: 999261

URL: http://svn.apache.org/viewvc?rev=999261&view=rev
Log:
FELIX-2605 : FilterHandler should pre-compile regular expression

Modified:
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java?rev=999261&r1=999260&r2=999261&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java
Tue Sep 21 07:54:36 2010
@@ -16,25 +16,28 @@
  */
 package org.apache.felix.http.base.internal.handler;
 
+import java.io.IOException;
+import java.util.regex.Pattern;
+
 import javax.servlet.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import org.apache.felix.http.base.internal.context.ExtServletContext;
-import java.io.IOException;
 
 public final class FilterHandler
     extends AbstractHandler implements Comparable<FilterHandler>
 {
     private final Filter filter;
-    private final String pattern;
+    private final Pattern regex;
     private final int ranking;
 
     public FilterHandler(ExtServletContext context, Filter filter, String pattern, int ranking)
     {
         super(context);
         this.filter = filter;
-        this.pattern = pattern;
         this.ranking = ranking;
+	    this.regex = Pattern.compile(pattern);
     }
 
     public Filter getFilter()
@@ -62,7 +65,7 @@ public final class FilterHandler
             uri = "/";
         }
 
-        return uri.matches(this.pattern);
+        return this.regex.matcher(uri).matches();
     }
 
     public void handle(HttpServletRequest req, HttpServletResponse res, FilterChain chain)



Mime
View raw message