You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Han Hong Fang (JIRA)" <de...@myfaces.apache.org> on 2010/10/19 06:26:26 UTC

[jira] Created: (MYFACES-2947) application configuration resources located in lib/*.jar can not be accessed in OSGi enviroment

application configuration resources located in lib/*.jar can not be accessed in OSGi enviroment
-----------------------------------------------------------------------------------------------

                 Key: MYFACES-2947
                 URL: https://issues.apache.org/jira/browse/MYFACES-2947
             Project: MyFaces Core
          Issue Type: Bug
          Components: General
    Affects Versions: 2.0.2, 2.0.0
            Reporter: Han Hong Fang


In OSGi environment, BundleClassLoader is used to get jar file resource. , and the conn (refer the code below) is BundleURLConnection, and will never be JarURLConnection. This causes faces configuration files under jar file can not be accessed in OSGi environment. 

Code segment from myfaces-impl-2.0.2-sources\org\apache\myfaces\view\facelets\util\Classpath.java

for (  Enumeration<URL> urls = loader.getResources(resource); urls.hasMoreElements();   )
        {
            URL url = urls.nextElement();
            URLConnection conn = url.openConnection();
            conn.setUseCaches(false);
            conn.setDefaultUseCaches(false);

            JarFile jar;
            if (conn instanceof JarURLConnection)
            {
                jar = ((JarURLConnection) conn).getJarFile();
            }
            else
            {
                jar = _getAlternativeJarFile(url);
            }

            if (jar != null)
            {
                _searchJar(loader, result, jar, prefix, suffix);
            }
            else
            {
                if (!_searchDir(result, new File(URLDecoder.decode(url.getFile(), "UTF-8")), suffix))
                {
                    _searchFromURL(result, prefix, suffix, url);
                }
            }
        }

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


[jira] Commented: (MYFACES-2947) application configuration resources located in lib/*.jar can not be accessed in OSGi enviroment

Posted by "Ivan (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12922441#action_12922441 ] 

Ivan commented on MYFACES-2947:
-------------------------------

Hi, Janet
    MyFaces has already provided one SPI FacesConfigResourceProvider interface, Geronimo should be able to use this SPI to provide some URL to MyFaces.

> application configuration resources located in lib/*.jar can not be accessed in OSGi enviroment
> -----------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2947
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2947
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.0.0, 2.0.2
>            Reporter: Han Hong Fang
>
> In OSGi environment, BundleClassLoader is used to get jar file resource. , and the conn (refer the code below) is BundleURLConnection, and will never be JarURLConnection. This causes faces configuration files under jar file can not be accessed in OSGi environment. 
> Code segment from myfaces-impl-2.0.2-sources\org\apache\myfaces\view\facelets\util\Classpath.java
> for (  Enumeration<URL> urls = loader.getResources(resource); urls.hasMoreElements();   )
>         {
>             URL url = urls.nextElement();
>             URLConnection conn = url.openConnection();
>             conn.setUseCaches(false);
>             conn.setDefaultUseCaches(false);
>             JarFile jar;
>             if (conn instanceof JarURLConnection)
>             {
>                 jar = ((JarURLConnection) conn).getJarFile();
>             }
>             else
>             {
>                 jar = _getAlternativeJarFile(url);
>             }
>             if (jar != null)
>             {
>                 _searchJar(loader, result, jar, prefix, suffix);
>             }
>             else
>             {
>                 if (!_searchDir(result, new File(URLDecoder.decode(url.getFile(), "UTF-8")), suffix))
>                 {
>                     _searchFromURL(result, prefix, suffix, url);
>                 }
>             }
>         }

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


[jira] Commented: (MYFACES-2947) application configuration resources located in lib/*.jar can not be accessed in OSGi enviroment

Posted by "Han Hong Fang (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12922450#action_12922450 ] 

Han Hong Fang commented on MYFACES-2947:
----------------------------------------

Thanks Ivan for pointing me to SPI FacesConfigResourceProvider interface.



> application configuration resources located in lib/*.jar can not be accessed in OSGi enviroment
> -----------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2947
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2947
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.0.0, 2.0.2
>            Reporter: Han Hong Fang
>
> In OSGi environment, BundleClassLoader is used to get jar file resource. , and the conn (refer the code below) is BundleURLConnection, and will never be JarURLConnection. This causes faces configuration files under jar file can not be accessed in OSGi environment. 
> Code segment from myfaces-impl-2.0.2-sources\org\apache\myfaces\view\facelets\util\Classpath.java
> for (  Enumeration<URL> urls = loader.getResources(resource); urls.hasMoreElements();   )
>         {
>             URL url = urls.nextElement();
>             URLConnection conn = url.openConnection();
>             conn.setUseCaches(false);
>             conn.setDefaultUseCaches(false);
>             JarFile jar;
>             if (conn instanceof JarURLConnection)
>             {
>                 jar = ((JarURLConnection) conn).getJarFile();
>             }
>             else
>             {
>                 jar = _getAlternativeJarFile(url);
>             }
>             if (jar != null)
>             {
>                 _searchJar(loader, result, jar, prefix, suffix);
>             }
>             else
>             {
>                 if (!_searchDir(result, new File(URLDecoder.decode(url.getFile(), "UTF-8")), suffix))
>                 {
>                     _searchFromURL(result, prefix, suffix, url);
>                 }
>             }
>         }

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