[jboss-osgi-issues] [JBoss JIRA] (JBOSGI-794) WAB Fragment resources are not available post-deployment

Arcadiy Ivanov (JIRA) issues at jboss.org
Thu May 12 03:28:01 EDT 2016


     [ https://issues.jboss.org/browse/JBOSGI-794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arcadiy Ivanov updated JBOSGI-794:
----------------------------------
    Description: 
{quote}
Actually my bundle-fragment gives me no possibility to load extra resources from it. I get only 404 when try to load /budget/portal/resources/angular-material/1.0.7/angular-material.css. I have found in log, that it was created an osgi-storage for my bundle-fragment withe start=false. Is it correct so? May be you could give me some advices, how to make it work.
{quote}
----

OSGI EE spec is as follows:
{quote}
128.6.3 Resource Lookup
The getResource and getResourceAsStream methods of the ServletContext interface are used to access resources in the web application. For a WAB, these resources must be found according to the findEntries method, this method includes fragments. For the getResource and getResourceAsStream method, if multiple resources are found, then the first one must be used.
Since the getResource and getResourceAsStream methods do not support wildcards while the findEntries method does it is necessary to escape the wildcard asterisk (’*’ \u002A) with prefixing it with a reverse solidus (backslash ’\’ \u005C). This implies that a reverse solidus must be escaped with an extra reverse solidus. For example, the path foo\bar* must be escaped to foo\\bar\*.
The getResourcePaths method must map to the Bundle getEntryPaths method, its return type is a Set and can not handle multiples. However, the paths from the getEntryPaths method are relative while the methods of the getResourcePaths must be absolute.
For example, assume the following manifest for a bundle:
Bundle-ClassPath: localized, WEB-INF
...
This WAB has an attached fragment acme-de.jar with the following content:
META-INF/MANIFEST.MF
localized/logo.png

The getResource method for localized/logo.png uses the findEntries method to find a resource in the directory /localized and the resource logo.png. Assuming the host bundle has no localized/ directory, the Web Runtime must serve the logo.png resource from the acme-de.jar.
{quote}
----

Default Undertow servlet delegates to ServletResourceManager.getResource() that goes straight for the physical path, bypassing OSGi entirely.
One possible solution is to use a servlet for all static content, but more investigation is needed.

  was:
{quote}
Actually my bundle-fragment gives me no possibility to load extra resources from it. I get only 404 when try to load /budget/portal/resources/angular-material/1.0.7/angular-material.css. I have found in log, that it was created an osgi-storage for my bundle-fragment withe start=false. Is it correct so? May be you could give me some advices, how to make it work.
{quote}



> WAB Fragment resources are not available post-deployment
> --------------------------------------------------------
>
>                 Key: JBOSGI-794
>                 URL: https://issues.jboss.org/browse/JBOSGI-794
>             Project: JBoss OSGi
>          Issue Type: Bug
>          Components: webapp, wildfly
>    Affects Versions: JBossOSGI 2.3.1, JBossOSGI 2.5.1, JBossOSGI 2.4.1
>            Reporter: Arcadiy Ivanov
>            Assignee: Arcadiy Ivanov
>         Attachments: com.mrs.budget.portal.jar, com.mrs.budget.portal.resources.jar, standalone.xml
>
>
> {quote}
> Actually my bundle-fragment gives me no possibility to load extra resources from it. I get only 404 when try to load /budget/portal/resources/angular-material/1.0.7/angular-material.css. I have found in log, that it was created an osgi-storage for my bundle-fragment withe start=false. Is it correct so? May be you could give me some advices, how to make it work.
> {quote}
> ----
> OSGI EE spec is as follows:
> {quote}
> 128.6.3 Resource Lookup
> The getResource and getResourceAsStream methods of the ServletContext interface are used to access resources in the web application. For a WAB, these resources must be found according to the findEntries method, this method includes fragments. For the getResource and getResourceAsStream method, if multiple resources are found, then the first one must be used.
> Since the getResource and getResourceAsStream methods do not support wildcards while the findEntries method does it is necessary to escape the wildcard asterisk (’*’ \u002A) with prefixing it with a reverse solidus (backslash ’\’ \u005C). This implies that a reverse solidus must be escaped with an extra reverse solidus. For example, the path foo\bar* must be escaped to foo\\bar\*.
> The getResourcePaths method must map to the Bundle getEntryPaths method, its return type is a Set and can not handle multiples. However, the paths from the getEntryPaths method are relative while the methods of the getResourcePaths must be absolute.
> For example, assume the following manifest for a bundle:
> Bundle-ClassPath: localized, WEB-INF
> ...
> This WAB has an attached fragment acme-de.jar with the following content:
> META-INF/MANIFEST.MF
> localized/logo.png
> The getResource method for localized/logo.png uses the findEntries method to find a resource in the directory /localized and the resource logo.png. Assuming the host bundle has no localized/ directory, the Web Runtime must serve the logo.png resource from the acme-de.jar.
> {quote}
> ----
> Default Undertow servlet delegates to ServletResourceManager.getResource() that goes straight for the physical path, bypassing OSGi entirely.
> One possible solution is to use a servlet for all static content, but more investigation is needed.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the jboss-osgi-issues mailing list