Hi Violeta,
   Thanks for the quick turnaround, I tested this fix and it seems to work
for non-jar resources, but when trying to load a jar under WEB-INF/lib, it
still returns null for the input stream. It looks like internally the jar
resource url is interpreted as a directory due to the "!/" suffix.

Regards,
   Detelin

2016-12-02 19:10 GMT+02:00 Violeta Georgieva <[email protected]>:

> Hi Detelin,
>
> Indeed there was a problem in Gemini Web.
> Here [1] you can find a fix for this issue.
>
> Best Regards,
> Violeta
>
> [1] http://git.eclipse.org/c/gemini.web/org.eclipse.gemini.
> web.gemini-web-container.git/commit/?id=2016847082b46fbfb4fe46f3a67433
> f538943bc2
>
>
> 2016-12-02 12:20 GMT+02:00 <[email protected]>:
> >
> > Hi again,
> >   Actually, the code that seem to fail is a combination of
> Servlet.Context.getResourcePaths() and ServletContext.getResourceAsStream().
> I'm attaching a modified Gemini Web wab sample with slf4j api jar added in
> WEB-INF/lib and the following code added in SimpleServlet:
> >
> > ServletContext servletContext = ...
> > Set<String> resourcePaths = servletContext.getResourcePaths("/WEB-INF/
> lib");
> > String resourcePath = resourcePaths.iterator().next();
> > InputStream inputStream = servletContext.getResourceAsStream(
> resourcePath);
> > System.out.println(String.format("InputStream for resource '%s' is:
> %s", resourcePath, inputStream));
> >
> > With Gemini Web 2.2.7 this prints:
> >
> > InputStream for resource '/WEB-INF/lib/org.slf4j.api.jar' is:
> org.eclipse.osgi.storage.bundlefile.ZipBundleEntry$
> ZipBundleEntryInputStream@405822b1
> >
> > With Gemini Web 3.0 RC2 the result is:
> >
> > InputStream for resource '/WEB-INF/lib/org.slf4j.api.jar/' is: null
> >
> > So it seems there is also a difference in the getResourcePaths method -
> with Tomcat 8 this returns a resource path with a trailing slash.So
> >
> > Regards,
> >    Detelin
> >
> >
> >
> > 2016-12-02 9:59 GMT+02:00 <[email protected]>:
> >>
> >> Hi,
> >>   We recently tried Gemini Web 3.0 RC2 with Tomcat 8.5.5 and
> encountered a resource handling problem for web application bundles. We
> have tested Web application bundles with some jars in WEB-ING/lib which
> provide rest services and noticed that Jersey was not able to load them. At
> the end, it turned out that 
> ServletContext.getResourceAsStream("WEB-INF/lib/foo.jar")
> always returns null, even though ServletContext.getResourcePaths()
> successfully lists the resources.
> >> This can be reproduced with Equinox 3.10 (Luna), Gemini Web 3.0 RC2 and
> a simple wab containing a jar in WEB-INF/lib.
> >> Could this be a problem in Gemini Web and/or Tomcat 8's new resource
> handling? I checked Gemini Web jira but did not find anything similar, will
> look further but thought I might just drop an email to see if anyone is
> aware of this issue.
> >>
> >> Regards,
> >>    Detelin
> >
> >
> >
> > _______________________________________________
> > gemini-dev mailing list
> > [email protected]
> > To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> > https://dev.eclipse.org/mailman/listinfo/gemini-dev
>
> _______________________________________________
> gemini-dev mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/gemini-dev
>
_______________________________________________
gemini-dev mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/gemini-dev

Reply via email to