Tutorial: Understanding the New Features of JSP 2.0
TLD Cache Features and
Files
For any application that uses
TLD caching, whether it is enabled at the global level or at the application
level, there are two levels of caching, and two aspects of caching at
each level. Let us see these caching levels in detail:
There is a global cache for TLD files that are in JAR
files in any well-known tag library locations.
There is an application-level cache for TLD files under
the application /WEB-INF directory.
At the application level, tag library JAR files, which include TLD files,
must be in the /WEB-INF/lib directory. Individual TLD files
can be directly in /WEB-INF or in any subdirectory, but preferably not
in /WEB-INF/lib or /WEB-INF/classes.
Caching aspects at each caching level
There is a file containing resource information
for the relevant location--the well-known location for the global
cache, or /WEB-INF or /WEB-INF/lib for the application-level cache.
Because of this feature, JAR files do not have to be scanned more
than once. The file contains two types of entries:
There is a list of all resources (tag library
JAR files) that includes a timestamp for each resource so that
any change to any resource can be detected. There is also an indication
("true" or "false") of whether each resource includes a TLD file.
There is a list of TLD files, where each entry consists of a
TLD name, TLD URI value if present, and tag library listeners
if present. (See "Tag
Library Event Listeners".)
There is a serialized DOM representation of each
TLD file. Because of this feature, TLD files do not have to be parsed
more than once.
Global Cache
The global cache is always located in a directory called tldcache,
parallel to the configuration directory. The tldcache directory
contains the following:
There is a file, _GlobalTldCache,
that contains resource information, as described above, for any well-known
locations.
There are DOM representations
of the TLD files that are in well-known locations. For each TLD file that
is in a JAR file in a well-known location, the DOM representation is in
a subdirectory according to the name of the JAR file, with a file name
according to the name of the TLD file. For example, if email.tld
is found in ojsputil.jar in a well-known location, then its
DOM representation would be in the following file (file name email in
directory ojsputil_jar):
This is for an Oracle Application Server environment, where ORACLE_HOME
is defined. In OC4J standalone, the j2ee directory is relative
to where OC4J is installed.
Application-level Cache
The application-level cache is in the directory indicated by the jsp-cache-directory
setting in either global-web-application.xml or orion-web.xml.
(See "OC4J
Configuration Parameters for JSP" for information about jsp-cache-directory.)
This directory contains the following:
=> There is a file, _TldCache, that
contains resource information, as described above, for TLD files under
the /WEB-INF directory--either in JAR files in /WEB-INF/lib, or individually
in /WEB-INF or any subdirectory, but preferably not /WEB-INF/lib or
/WEB-INF/classes.
=> There are DOM representations of the TLD files
under /WEB-INF. For TLD files that are in JAR files in the /WEB-INF/lib
directory, the DOM representations go into subdirectories under the
directory indicated by jsp-cache-directory, in the same
type of scheme as described for the global cache. For individual TLD
files under /WEB-INF, the DOM representations go directly in the jsp-cache-directory
location.
Important Notes
TLD changes at the global level
are reflected only after OC4J is restarted.
TLD changes at the application
level are reflected immediately in an OC4J standalone environment, but
only after the application is restarted in an Oracle Application Server
environment.
You can increase the OC4J verbosity
level to see information regarding construction of TLD caches and regarding
any TLD URIs that are duplicated. Level 4 provides some information; level
5 provides additional information. You can use Oracle Enterprise Manager
to set the verbosity level. The default level is 3.