Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Auge2019-03-06 09:51:07 -0500
committerRaymond Auge2019-03-25 10:27:45 -0400
commiteef56d7fab3c18eefe1c226d8eca0e979143e5ed (patch)
tree24ec85878e7802a143e9abaadf6fab9fc211bedd
parent3a9adc44c41e1bdea79c4bd99e4002776e1f254d (diff)
downloadrt.equinox.bundles-eef56d7fab3c18eefe1c226d8eca0e979143e5ed.tar.gz
rt.equinox.bundles-eef56d7fab3c18eefe1c226d8eca0e979143e5ed.tar.xz
rt.equinox.bundles-eef56d7fab3c18eefe1c226d8eca0e979143e5ed.zip
Bug 545135 - [http whiteboard] optimize context select matching a little bitI20190325-1800
Signed-off-by: Raymond Auge <raymond.auge@liferay.com> Change-Id: I7e8cbe08912b80ef317a022c8ecf9b73901df538
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java36
1 files changed, 22 insertions, 14 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java
index 5620a6a1..7b131d7a 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java
@@ -862,13 +862,21 @@ public class ContextController {
}
public boolean matches(ServiceReference<?> whiteBoardService) {
- String contextSelector = (String) whiteBoardService.getProperty(
- HTTP_WHITEBOARD_CONTEXT_SELECT);
// make sure the context helper is either one of the built-in ones registered by this http whiteboard implementation;
// or is visible to the whiteboard registering bundle.
+
if (!visibleContextHelper(whiteBoardService)) {
return false;
}
+
+ String contextSelector = (String) whiteBoardService.getProperty(
+ HTTP_WHITEBOARD_CONTEXT_SELECT);
+
+ // custom equinox behaviour
+ if (contextName.equals(contextSelector)) {
+ return true;
+ }
+
if (contextSelector == null) {
contextSelector = httpServiceRuntime.getDefaultContextSelectFilter(whiteBoardService);
if (contextSelector == null) {
@@ -878,22 +886,22 @@ public class ContextController {
}
}
- if (!contextSelector.startsWith(Const.OPEN_PAREN)) {
- contextSelector = Const.OPEN_PAREN +
- HTTP_WHITEBOARD_CONTEXT_NAME +
- Const.EQUAL + contextSelector + Const.CLOSE_PAREN;
- }
+ if (contextSelector.startsWith(Const.OPEN_PAREN)) {
+ org.osgi.framework.Filter targetFilter;
- org.osgi.framework.Filter targetFilter;
+ try {
+ targetFilter = FrameworkUtil.createFilter(contextSelector);
+ }
+ catch (InvalidSyntaxException ise) {
+ throw new IllegalArgumentException(ise);
+ }
- try {
- targetFilter = FrameworkUtil.createFilter(contextSelector);
- }
- catch (InvalidSyntaxException ise) {
- throw new HttpWhiteboardFailureException(ise.getMessage(), DTOConstants.FAILURE_REASON_VALIDATION_FAILED);
+ if (matches(targetFilter)) {
+ return true;
+ }
}
- return matches(targetFilter);
+ return false;
}
private boolean visibleContextHelper(ServiceReference<?> whiteBoardService) {

Back to the top