Community
Participate
Working Groups
Build Identifier: Hi, I have the following scenario: In my servlet I get a resource from the classloader: URL resourceURL = this.getClass().getResource("resource.txt"); With the received URL I want to construct a file and to read its content: File refourceFile = new File(resourceURL.toURI()); The result from the File construction is: java.lang.IllegalArgumentException: URI scheme is not "file" The problem is because the URL for the resource is returned like this bundleresource://46.fwk30983464/test/resource.txt The URI scheme is not known for the File, which expects the URI scheme to be "file". In the OSGi Enterprise Specification, Web Applications Specification there are clarifications only for ServletContext.getResource() method. I saw that in Virgo project additional equinox extension is introduced that solves this problem. org.eclipse.virgo.osgi.extensions.equinox.hooks. ExtendedBundleFileWrapperFactoryHook Is it possible to introduce such extension for Gemini.Web as this functionality is widely used? Or if you consider it as expected, is it possible to document it? Thanks in advance. Best Regards Violeta Reproducible: Always Steps to Reproduce: 1. Start the Gemini.Web 2. In the console install the attached web application: install webbundle:file:<path-to-web-app>?Web-ContextPath=/test-app 3. Start the web application bundle 4. Request http://localhost:8080/test-app/TestServlet 5. Exception is thrown in the console: java.lang.IllegalArgumentException: URI scheme is not "file"
Created attachment 179107 [details] test web application
Hi Violeta This calls for some careful thought. For starters, I've documented a limitation: http://wiki.eclipse.org/Gemini/Web#Limitations Looking to the future, I am reticent to build an Equinox hook into Gemini Web since: * I'd like to minimise the Equinox-specific code to ensure consistent behaviour on other OSGi framework implementations such as Felix, * such a hook is likely to conflict with Equinox hooks provided by a container which embeds Gemini Web, * the hook needs installing into Equinox earlier than Gemini Web, so this complicates the start up procedure for Gemini Web when the hook is required. The Virgo hook is actually pretty small and users (application server implementers) who care can reuse the Virgo hook fairly easily. So I'm closing this as WONTFIX. If compelling use cases arise, I'm happy to reconsider. Regards, Glyn
Thanks Regards Violeta