felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Misha Koshelev <misha...@gmail.com>
Subject Apache Felix HTTP service HttpServiceImpl.isNameValid does not match OSGi R4.2 spec?
Date Mon, 08 Nov 2010 22:24:47 GMT
Dear All:

Thank you all for your help and patience with me.

I am working on the following OpenMRS ticket:

I am trying to use Apache Felix instead of Spring DM Web Extender.

I have had some problems with JSP support, and am trying to use the
Equinox JSP bundle:
with Felix, specifically using the bridge sample in 2.0.4. I have
double checked code in trunk.

I _am_ successful with Equinox servlet bridge, see:

However, this example:

contains the following lines in org.eclipse.equinox.jsp.examples.Activator:

				HttpContext commonContext = new
BundleEntryHttpContext(context.getBundle(), "/web"); //$NON-NLS-1$
				httpService.registerResources("/jsp-examples", "/",
commonContext); //$NON-NLS-1$ //$NON-NLS-2$

				Servlet adaptedJspServlet = new ContextPathServletAdaptor(new
JspServlet(context.getBundle(), "/web"), "/jsp-examples");
adaptedJspServlet, null, commonContext); //$NON-NLS-1$

Felix bridge complains:

java.lang.IllegalArgumentException: Malformed resource name [/]
	at org.apache.felix.http.base.internal.service.HttpServiceImpl.registerResources(HttpServiceImpl.java:105)
	at org.eclipse.equinox.jsp.examples.Activator$HttpServiceTracker.addingService(Activator.java:38)
	at org.osgi.util.tracker.ServiceTracker$Tracked.trackAdding(ServiceTracker.java:1030)

The relevant code, in trunk, is, from

 public void registerResources(String alias, String name, HttpContext context)
        throws NamespaceException
        if (!isNameValid(name)) {
            throw new IllegalArgumentException( "Malformed resource
name [" + name + "]");


private boolean isNameValid(String name)
        if (name == null) {
            return false;

        if (name.endsWith( "/" )) {
            return false;

        return true;

However, the R4.2 enterprise spec from
on page 48 clearly states:

The name parameter must also not end with slash (’/’) with the
exception that a name of the form “/” is used to denote the root of
the bundle.

Should isNameValid not read, similar to isAliasValid, in the same file:

    private boolean isNameValid(String name)
        if (name == null) {
            return false;

        if (!name.equals("/") && ( !name.startsWith("/") ||
name.endsWith("/"))) {
            return false;

        return true;


Thank you


View raw message