Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [gemini-dev] Broken WAB resource handling in Tomcat 8

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 <detelinyordanov@xxxxxxxxx>:
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

Attachment: osgi.web.app_1.0.0.war
Description: Binary data


Back to the top