You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jarek Gawor (JIRA)" <de...@myfaces.apache.org> on 2010/02/11 06:02:27 UTC

[jira] Created: (MYFACES-2548) META-INF resource lookup in OSGi environment

META-INF resource lookup in OSGi environment
--------------------------------------------

                 Key: MYFACES-2548
                 URL: https://issues.apache.org/jira/browse/MYFACES-2548
             Project: MyFaces Core
          Issue Type: Improvement
          Components: General
    Affects Versions: 2.0.0-beta-2
            Reporter: Jarek Gawor


MyFaces uses context class loader to lookup META-INF resources. This works fine in a regular Java environment but breaks in OSGi. One easy solution for this would be to first ask the CCL for the resource and if none is found ask the surrounding class class loader for that resource (assuming the resource we are looking for lives in the same jar as the class loading it), i.e.:

URL foo = getContextClassLoader().getResource("META-INF/foo");
if (foo == null) {
  foo = getClass().getClassLoader().getResource("META-INF/foo");
}

There are a few places in MyFaces code that would need to be updated to use this fallback approach. For example in IncludeHandler.java and ErrorPageWriter.java.

I also noticed that for some reason the myfaces-dev-debug.xml and myfaces-dev-error.xml live in the api module. They seem to be only used the impl module so they shouldn't really be needed in the api module. 



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MYFACES-2548) META-INF resource lookup in OSGi environment

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr resolved MYFACES-2548.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0-beta-2

> META-INF resource lookup in OSGi environment
> --------------------------------------------
>
>                 Key: MYFACES-2548
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2548
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: General
>    Affects Versions: 2.0.0-beta-2
>            Reporter: Jarek Gawor
>            Assignee: Jakob Korherr
>             Fix For: 2.0.0-beta-2
>
>         Attachments: MYFACES-2548.patch
>
>
> MyFaces uses context class loader to lookup META-INF resources. This works fine in a regular Java environment but breaks in OSGi. One easy solution for this would be to first ask the CCL for the resource and if none is found ask the surrounding class class loader for that resource (assuming the resource we are looking for lives in the same jar as the class loading it), i.e.:
> URL foo = getContextClassLoader().getResource("META-INF/foo");
> if (foo == null) {
>   foo = getClass().getClassLoader().getResource("META-INF/foo");
> }
> There are a few places in MyFaces code that would need to be updated to use this fallback approach. For example in IncludeHandler.java and ErrorPageWriter.java.
> I also noticed that for some reason the myfaces-dev-debug.xml and myfaces-dev-error.xml live in the api module. They seem to be only used the impl module so they shouldn't really be needed in the api module. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.