2012/10/17 Mark Thomas <ma...@apache.org>:
> On 17/10/2012 15:07, Konstantin Kolinko wrote:
>
>> 1. Are <PreResource> and <PostResource> able to inject individual files?
>
> Not yet, but that should be relatively simple to implement.
>
>> 2. I am -1 on removal of VirtualWebappLoader.
>>
>> The feature of injecting additional classpath entries into
>> WebappClassLoader.super.addURL() is an important one and I use it a
>> lot to inject external dependent libraries into web applications.
>>
>> I do not like your approach as a replacement, because classpath
>> entries handling (jars handling) in URLClassLoader and in
>> WebappClassLoader is based on different requirements. I think that
>> URLClassLoader serves better for external libraries
>
> Could you expand on this please. I'm struggling to see the difference
> between using the VirtualWebappLoader and mapping JARs into WEB-INF/lib
> and directories containing classes onto WEB-INF/classes
>

There is a difference,
but after thinking about it I am removing my veto.


1. If I consider the following two operations
a. adding a library to the classpath
b. maintaining it as a proper webapplication resource

if "a." is all that I need, then having (a. + b.) will have an
additional overhead.

What VirtualWebappLoader does is essentially similar to putting a
library into  $CATALINA_BASE/shared.


I know of the following overheads:
1.1.) An additional resource participates in resource lookups

In my use case I insert a dozen of libraries into the classpath. I do
not use VirtualWebappLoader directly, I am calling the API that it
uses - WebappLoader.addRepository().

Looking at the example of Tomcat 7 aliases, if you have 100 aliases
then every resource lookup will perform a linear search through all
the aliases.

Regarding my question of injecting individual files into resources -
maybe it would be better to support collections of individual files
rather than files themselves. E.g. wrap a dozen of libraries into
single collection for "/WEB-INF/lib".

This way the individual libraries will be enumerated only when one is
searching for something with a prefix of "/WEB-INF/lib". Searching for
any other prefix will skip the libraries.


1.2.) WebappClassLoader#closeJARs(..)
WebappClassLoader closes unused JARs after some time of inactivity.

Discussed here:
https://issues.apache.org/bugzilla/show_bug.cgi?id=52448

I do not see much sense in this jar closing feature. Anyway,
URLClassLoader keeps its jars open.

(Not much of an issue, though. If it were a real nuisance, we can make
it configurable).


2. There will be small difference with handling of
VirtualWebappLoader#setSearchVirtualFirst( ) property.

 With VirtualWebappLoader and searchVirtualFirst=true the order of
precedence when looking of a class is
   {external classes and libs, webapp classes, webapp libs}.

With webresources I think the order will be different, because
WEB-INF/classes takes precedence over WEB-INF/lib:
   {external classes, webapp classes, external libs, webapp libs}.

It is a little nuance. I do not think there will be much confusion from it.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to