This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new 64da8abea8 FELIX-6755 : Create filter directly
64da8abea8 is described below

commit 64da8abea8ca564e16259c643c34661c12918000
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Feb 10 14:49:59 2025 +0100

    FELIX-6755 : Create filter directly
---
 .../org/apache/felix/http/proxy/AbstractProxyServlet.java |  2 +-
 .../apache/felix/http/proxy/impl/DispatcherTracker.java   | 15 ++-------------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git 
a/http/proxy/src/main/java/org/apache/felix/http/proxy/AbstractProxyServlet.java
 
b/http/proxy/src/main/java/org/apache/felix/http/proxy/AbstractProxyServlet.java
index 9bd42de107..0d0a23f520 100755
--- 
a/http/proxy/src/main/java/org/apache/felix/http/proxy/AbstractProxyServlet.java
+++ 
b/http/proxy/src/main/java/org/apache/felix/http/proxy/AbstractProxyServlet.java
@@ -90,7 +90,7 @@ public abstract class AbstractProxyServlet
                 }
             };
         }
-        this.tracker = new DispatcherTracker(getBundleContext(), null, config);
+        this.tracker = new DispatcherTracker(getBundleContext(), config);
         this.tracker.open();
     }
 
diff --git 
a/http/proxy/src/main/java/org/apache/felix/http/proxy/impl/DispatcherTracker.java
 
b/http/proxy/src/main/java/org/apache/felix/http/proxy/impl/DispatcherTracker.java
index 1d7baf771e..f0f1b99522 100644
--- 
a/http/proxy/src/main/java/org/apache/felix/http/proxy/impl/DispatcherTracker.java
+++ 
b/http/proxy/src/main/java/org/apache/felix/http/proxy/impl/DispatcherTracker.java
@@ -21,7 +21,6 @@ import jakarta.servlet.http.HttpServlet;
 
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
 import org.osgi.framework.ServiceReference;
 import org.osgi.util.tracker.ServiceTracker;
 
@@ -33,10 +32,10 @@ public final class DispatcherTracker
     private final ServletConfig config;
     private HttpServlet dispatcher;
 
-    public DispatcherTracker(BundleContext context, String filter, 
ServletConfig config)
+    public DispatcherTracker(BundleContext context, ServletConfig config)
         throws Exception
     {
-        super(context, createFilter(context, filter), null);
+        super(context, context.createFilter(DEFAULT_FILTER), null);
         this.config = config;
     }
 
@@ -94,14 +93,4 @@ public final class DispatcherTracker
             log("Failed to initialize dispatcher", e);
         }
     }
-
-    private static Filter createFilter(BundleContext context, String filter)
-        throws Exception
-    {
-        StringBuffer str = new StringBuffer();
-        str.append("(&(").append(Constants.OBJECTCLASS).append("=");
-        str.append(HttpServlet.class.getName()).append(")");
-        str.append(filter != null ? filter : DEFAULT_FILTER).append(")");
-        return context.createFilter(str.toString());
-    }
 }

Reply via email to