tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: About scanAllDirectories,JarScanner and expanded JAR
Date Thu, 18 Dec 2014 18:00:29 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Mark,

On 12/18/14 9:38 AM, Mark Thomas wrote:
> On 18/12/2014 14:18, Christopher Schultz wrote:
> 
>> Mark, can you clarify what behavior will actually change when 
>> scanAllDirectories="true" is set?
> 
> A JAR file is scanned for SCIs, static resources etc. A directory
> of classes is not. Setting scanAllDirectories causes directories of
> classes (including WEB-INF/classes) to be treated as expanded JAR
> files. It is normally only used when integrating with an IDE.

Interesting.

I was about to say:

"Does that mean that, under a default configuration, having an SCI in
your WEB-INF/classes will not be found and called? That would be
surprising to me if I were trying to use SCIs directly in my
application (as opposed to using them indirectly, through a library,
as usually happens)."

...until I read the documentation for SCI which says this at the end:

"
Implementations of this interface must be declared by a JAR file
resource located inside the META-INF/services directory and named for
the fully qualified class name of this interface, and will be
discovered using the runtime's service provider lookup mechanism or a
container specific mechanism that is semantically equivalent to it. In
either case, ServletContainerInitializer services from web fragment
JAR files excluded from an absolute ordering must be ignored, and the
order in which these services are discovered must follow the
application's classloading delegation model.
"

I've never (directly) used SCIs or META-INF/services or static
resources of anything like that so I didn't know about them having to
be packaged in a certain way.

So, under normal circumstances, only CATALINA_HOME/lib,
CATALINA_BASE/lib, and WEB-INF/classes would fail to have SCIs and
static resources scanned/loaded from them directly, and enabling this
feature would allow you to put e.g. META-INF/services into
CATALINA_BASE/lib and then configure services there.

So the only real use case for this is when you are customizing the
webapp's classpath in some way (which IDEs do) or if you want to write
your own SCI or use static resources without packaging them into JARs
and putting them in WEB-INF/lib. I can see that being a valid use
case, but probably one that is very rare.

Thanks for the clarification,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUkxY9AAoJEBzwKT+lPKRYnlgP/jXCtr3HhRYy5W0vLwX04NIt
Ht8tai57j11UFsQqDnb9mppJ75L8JPVMgm7jAKZOQtfo5gIZhLl9VXlbCMFuZxTh
RizJoAejYGmWY2qxXtQ7x8q+8gHMPldjpjtgSc4ORRJ0ME3O1PZIDggBxFp+S7Cy
N7RNDoWZ9PX02kkJzojTzb9dy/NvXScYi/KnJ9w2dOtJFFzlqlgn0f9sUJP00mSm
I/j37bhIYowiFzhh3CYNEAVwTUaXJhiRyGue7ABmjguCu28Ys1HwvSKQcE3e0Skd
eOgmQbafqWZO1bkhlSiAvGDs+HEd1zctnxwOsg1+uLW1c/FyKXMD3ptI+kPg0fh4
SRU29U/22v85SH+fqUQ27Oltkk/WR2645FJwz1usaO2JZsz3S18KBpq9+2XxEPWq
TS7k0dPruC2SJF+eaWwCuq1q0NfJVk1Ri2ighTmeABBKJCJgy9hJZUup/u8VRZJR
vQpM9Sz7pWwBvBNliC88q7iJqqPvWZPWvmz+u7XA8AAs7DuKkaRLIdQo12imsHy8
9QlpFyEfNeomEAKvOEeJelkUcaBkiXyBHT08zRrejhClRjSbqGVeiTQu4aWBBtob
xbersVEiY7FstpvLGgLMOW2zJhCrCyfYTYsJ0XZ/BVuQkHtZ+ZG+u2h5nIFGLTcw
h9o4aSxyB9NA8pJ8CL2I
=HzPs
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message