You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Ivan <xh...@gmail.com> on 2010/05/10 15:55:59 UTC

How to support loading resources in META-INF/resources of jar files in WEB-INF/*.jar

Hi,
    In Servlet 3.0, it is allowed to load the resource from
META-INF/resources of jar files in the WEB-INF folder while it is not found
in root folder. But now, in our BundleDirContext, there is not a direct way
(like getEntry) to read the resource.
    1. The simplest wayt is to wrap the url with zip stream, then iterator
it to find the resource. But it seems less efficient.
    2. Extract META-INF/resources from those jar files to the temp folders (
even one big folder) while starting the bundleDirContext. With this
solution, extra disk space is required
    3. Use classloader to load resource, with this, we may load some
unwanted resource ...
    Personally, I like the #2.  Any thoughts ?
-- 
Ivan

Re: How to support loading resources in META-INF/resources of jar files in WEB-INF/*.jar

Posted by Ivan <xh...@gmail.com>.
Thanks, Jack, it sounds a good idea. We even could give a global setting
whether we need to refresh the folder while starting the web application.
I am still thinking whether OSGI provides any easy api to acccess those
contents in the embbed jar files of bundle. If anyone know, please help to
figure out :-)

2010/5/11 Jack Cai <gr...@gmail.com>

> Shall we take #2 but do the extraction at deployment time? I understand it
> will break some user scenarios (e.g., update a CAR manually hoping a server
> restart will see the new content). But this is worth sacrificing considering
> that it will improve app startup performance - which is a much more frequent
> scenario.
>
> -Jack
>
>
> On Mon, May 10, 2010 at 9:55 PM, Ivan <xh...@gmail.com> wrote:
>
>> Hi,
>>     In Servlet 3.0, it is allowed to load the resource from
>> META-INF/resources of jar files in the WEB-INF folder while it is not found
>> in root folder. But now, in our BundleDirContext, there is not a direct way
>> (like getEntry) to read the resource.
>>     1. The simplest wayt is to wrap the url with zip stream, then iterator
>> it to find the resource. But it seems less efficient.
>>     2. Extract META-INF/resources from those jar files to the temp folders
>> ( even one big folder) while starting the bundleDirContext. With this
>> solution, extra disk space is required
>>     3. Use classloader to load resource, with this, we may load some
>> unwanted resource ...
>>     Personally, I like the #2.  Any thoughts ?
>> --
>> Ivan
>>
>
>


-- 
Ivan

Re: How to support loading resources in META-INF/resources of jar files in WEB-INF/*.jar

Posted by Jack Cai <gr...@gmail.com>.
Shall we take #2 but do the extraction at deployment time? I understand it
will break some user scenarios (e.g., update a CAR manually hoping a server
restart will see the new content). But this is worth sacrificing considering
that it will improve app startup performance - which is a much more frequent
scenario.

-Jack

On Mon, May 10, 2010 at 9:55 PM, Ivan <xh...@gmail.com> wrote:

> Hi,
>     In Servlet 3.0, it is allowed to load the resource from
> META-INF/resources of jar files in the WEB-INF folder while it is not found
> in root folder. But now, in our BundleDirContext, there is not a direct way
> (like getEntry) to read the resource.
>     1. The simplest wayt is to wrap the url with zip stream, then iterator
> it to find the resource. But it seems less efficient.
>     2. Extract META-INF/resources from those jar files to the temp folders
> ( even one big folder) while starting the bundleDirContext. With this
> solution, extra disk space is required
>     3. Use classloader to load resource, with this, we may load some
> unwanted resource ...
>     Personally, I like the #2.  Any thoughts ?
> --
> Ivan
>