Skip to content

Commit 06a1063

Browse files
committed
Use HttpWhiteboard instead of extension point for NavServlet
Currently the help center uses equinox specific extension points to register its servlets but there is actually a standard OSGi way to do so with R7 the Http Whiteboard Service. This migrates the NavServlet as a very first step to investigate if any issues are to be discovered. If that works all other servlets should be migrated as well.
1 parent 3f12c83 commit 06a1063

File tree

7 files changed

+25
-7
lines changed

7 files changed

+25
-7
lines changed

ua/org.eclipse.help.webapp/.project

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
<arguments>
2626
</arguments>
2727
</buildCommand>
28+
<buildCommand>
29+
<name>org.eclipse.pde.ds.core.builder</name>
30+
<arguments>
31+
</arguments>
32+
</buildCommand>
2833
</buildSpec>
2934
<natures>
3035
<nature>org.eclipse.jdt.core.javanature</nature>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dsVersion=V1_4
2+
eclipse.preferences.version=1
3+
enabled=true
4+
generateBundleActivationPolicyLazy=true
5+
path=OSGI-INF
6+
validationErrorLevel=error
7+
validationErrorLevel.missingImplicitUnbindMethod=error

ua/org.eclipse.help.webapp/META-INF/MANIFEST.MF

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Require-Bundle: org.eclipse.help.base;bundle-version="[4.3.200,5.0.0)",
1010
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
1111
org.eclipse.equinox.jsp.jasper.registry;bundle-version="1.0.100",
1212
org.eclipse.jdt.core.compiler.batch;bundle-version="[3.33.0,4.0.0)"
13+
Service-Component: OSGI-INF/org.eclipse.help.internal.webapp.servlet.NavServlet.xml
1314
Export-Package: org.eclipse.help.internal.webapp;x-friends:="org.eclipse.ua.tests",
1415
org.eclipse.help.internal.webapp.data;x-friends:="org.eclipse.ua.tests",
1516
org.eclipse.help.internal.webapp.parser;x-internal:=true,
@@ -19,6 +20,7 @@ Export-Package: org.eclipse.help.internal.webapp;x-friends:="org.eclipse.ua.test
1920
org.eclipse.help.webapp
2021
Bundle-RequiredExecutionEnvironment: JavaSE-21
2122
Import-Package: javax.servlet;version="3.1.0",
22-
javax.servlet.http;version="3.1.0"
23+
javax.servlet.http;version="3.1.0",
24+
org.osgi.service.http.whiteboard.propertytypes;version="[1.1.0,2.0.0)"
2325
Bundle-ActivationPolicy: lazy
2426
Automatic-Module-Name: org.eclipse.help.webapp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/*.xml

ua/org.eclipse.help.webapp/build.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ bin.includes = plugin.xml,\
2424
advanced/,\
2525
.options,\
2626
advancedstate/,\
27-
m/
27+
m/,\
28+
OSGI-INF/
2829
output.. = bin/
2930
javacWarnings..=-unavoidableGenericProblems
3031

ua/org.eclipse.help.webapp/plugin.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@
7777
class="org.eclipse.help.internal.webapp.servlet.ContentServlet"
7878
httpcontextId="help">
7979
</servlet>
80-
<servlet
81-
alias="/nav"
82-
class="org.eclipse.help.internal.webapp.servlet.NavServlet"
83-
httpcontextId="help">
84-
</servlet>
8580
<servlet
8681
alias="/livehelp"
8782
class="org.eclipse.help.internal.webapp.servlet.LiveHelpServlet"

ua/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Locale;
2222
import java.util.StringTokenizer;
2323

24+
import javax.servlet.Servlet;
2425
import javax.servlet.ServletException;
2526
import javax.servlet.http.HttpServlet;
2627
import javax.servlet.http.HttpServletRequest;
@@ -35,11 +36,17 @@
3536
import org.eclipse.help.internal.webapp.data.RequestScope;
3637
import org.eclipse.help.internal.webapp.data.UrlUtil;
3738
import org.eclipse.help.webapp.IFilter;
39+
import org.osgi.service.component.annotations.Component;
40+
import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletName;
41+
import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletPattern;
3842

3943
/*
4044
* Generates navigation pages where topics are not present in the table
4145
* of contents. Displays links to the direct child topics.
4246
*/
47+
@Component(service = Servlet.class)
48+
@HttpWhiteboardServletName("nav")
49+
@HttpWhiteboardServletPattern("/nav/*")
4350
public class NavServlet extends HttpServlet {
4451

4552
private static final long serialVersionUID = 1L;

0 commit comments

Comments
 (0)