You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Karl Pauls (Jira)" <ji...@apache.org> on 2020/12/11 21:09:00 UTC
[jira] [Updated] (FELIX-6294) Missing trailing slash with
Bundle.getResource() for directory entry
[ https://issues.apache.org/jira/browse/FELIX-6294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Karl Pauls updated FELIX-6294:
------------------------------
Fix Version/s: (was: framework-5.6.14)
(was: framework-6.0.4)
framework-7.0.0
> Missing trailing slash with Bundle.getResource() for directory entry
> --------------------------------------------------------------------
>
> Key: FELIX-6294
> URL: https://issues.apache.org/jira/browse/FELIX-6294
> Project: Felix
> Issue Type: Bug
> Components: Framework
> Affects Versions: framework-5.6.12
> Reporter: Grzegorz Grzybek
> Assignee: Jean-Baptiste Onofré
> Priority: Major
> Fix For: framework-7.0.0
>
>
> I'm working on Pax Web 8 and I try to unify _welcome file_ handling across Jetty/Tomcat/Undertow.
> When accessing _directory entries_ from a bundle ({{org.osgi.framework.Bundle#getResource()}} I found different behavior between Felix and Equinox.
> Trying to pass {{/META-INF/}} and {{/META-INF}} resource names to {{getResource()}} method, I'm getting different results for Felix:
> * bundle://19.0:1/META-INF/
> * bundle://19.0:1/META-INF
> and Equinox:
> * bundleresource://19.fwk1529115495/META-INF/
> * bundleresource://19.fwk1529115495/META-INF/
> Underneath, both implementations call {{java.util.zip.ZipFile#getEntry(java.lang.String)}}, but only Equniox has special {{org.eclipse.osgi.storage.bundlefile.BundleFile#fixTrailingSlash()}} method that adjusts the returned URL according to passed name and actual ZIP entry ({{java.util.zip.ZipEntry#getName()}}.
> This makes detection of _a directory_ obtained from a bundle much harder with Felix. Also {{org.eclipse.jetty.util.resource.URLResource#isDirectory()}} is simply:
> {code:java}
> public boolean isDirectory()
> {
> return exists() && _urlString.endsWith("/");
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)