Skip to content

Commit 64da8ab

Browse files
committed
FELIX-6755 : Create filter directly
1 parent 7fbe436 commit 64da8ab

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

http/proxy/src/main/java/org/apache/felix/http/proxy/AbstractProxyServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public String getInitParameter(String name) {
9090
}
9191
};
9292
}
93-
this.tracker = new DispatcherTracker(getBundleContext(), null, config);
93+
this.tracker = new DispatcherTracker(getBundleContext(), config);
9494
this.tracker.open();
9595
}
9696

http/proxy/src/main/java/org/apache/felix/http/proxy/impl/DispatcherTracker.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import org.osgi.framework.BundleContext;
2323
import org.osgi.framework.Constants;
24-
import org.osgi.framework.Filter;
2524
import org.osgi.framework.ServiceReference;
2625
import org.osgi.util.tracker.ServiceTracker;
2726

@@ -33,10 +32,10 @@ public final class DispatcherTracker
3332
private final ServletConfig config;
3433
private HttpServlet dispatcher;
3534

36-
public DispatcherTracker(BundleContext context, String filter, ServletConfig config)
35+
public DispatcherTracker(BundleContext context, ServletConfig config)
3736
throws Exception
3837
{
39-
super(context, createFilter(context, filter), null);
38+
super(context, context.createFilter(DEFAULT_FILTER), null);
4039
this.config = config;
4140
}
4241

@@ -94,14 +93,4 @@ private void initDispatcher()
9493
log("Failed to initialize dispatcher", e);
9594
}
9695
}
97-
98-
private static Filter createFilter(BundleContext context, String filter)
99-
throws Exception
100-
{
101-
StringBuffer str = new StringBuffer();
102-
str.append("(&(").append(Constants.OBJECTCLASS).append("=");
103-
str.append(HttpServlet.class.getName()).append(")");
104-
str.append(filter != null ? filter : DEFAULT_FILTER).append(")");
105-
return context.createFilter(str.toString());
106-
}
10796
}

0 commit comments

Comments
 (0)