Hi Misha,

This in fact looks like a bug. Do you mind filing a JIRA issue at
https://issues.apache.org/jira/browse/FELIX. Thanks alot.

Regards
Felix

Am Montag, den 08.11.2010, 16:24 -0600 schrieb Misha Koshelev: 
> Dear All:
> 
> Thank you all for your help and patience with me.
> 
> I am working on the following OpenMRS ticket:
> http://tickets.openmrs.org/browse/TRUNK-1596
> 
> 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:
> http://www.eclipse.org/equinox/server/jsp_support.php
> 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:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329706
> 
> However, this example:
> http://prdownloads.sourceforge.net/sse-examples/org.eclipse.equinox.jsp.examples-proj.zip?download
> 
> 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");
> //$NON-NLS-1$//$NON-NLS-2$
>                               
> httpService.registerServlet("/jsp-examples/*.jsp",
> 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
> http://svn.apache.org/repos/asf/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java
> 
> 
>  public void registerResources(String alias, String name, HttpContext context)
>         throws NamespaceException
>     {
>         if (!isNameValid(name)) {
>             throw new IllegalArgumentException( "Malformed resource
> name [" + name + "]");
>         }
> ...
> 
> and
> 
> 
> private boolean isNameValid(String name)
>     {
>         if (name == null) {
>             return false;
>         }
> 
>         if (name.endsWith( "/" )) {
>             return false;
>         }
> 
>         return true;
>     }
> 
> However, the R4.2 enterprise spec from
> http://www.osgi.org/Download/File?url=/download/r4v42/r4.enterprise.pdf
> 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
> 
> Yours
> Misha


Reply via email to