org.apache.jasper.runtime
类 TldScanner
java.lang.Object
org.apache.jasper.runtime.TldScanner
- 所有已实现的接口:
- ServletContainerInitializer
public class TldScanner
- extends Object
- implements ServletContainerInitializer
A container for all tag libraries that are defined "globally"
for the web application.
Tag Libraries can be defined globally in one of two ways:
1. Via elements in web.xml:
the uri and location of the tag-library are specified in
the element.
2. Via packaged jar files that contain .tld files
within the META-INF directory, or some subdirectory
of it. The taglib is 'global' if it has the
element defined.
A mapping between the taglib URI and its associated TaglibraryInfoImpl
is maintained in this container.
Actually, that's what we'd like to do. However, because of the
way the classes TagLibraryInfo and TagInfo have been defined,
it is not currently possible to share an instance of TagLibraryInfo
across page invocations. A bug has been submitted to the spec lead.
In the mean time, all we do is save the 'location' where the
TLD associated with a taglib URI can be found.
When a JSP page has a taglib directive, the mappings in this container
are first searched (see method getLocation()).
If a mapping is found, then the location of the TLD is returned.
If no mapping is found, then the uri specified
in the taglib directive is to be interpreted as the location for
the TLD of this tag library.
- 作者:
- Pierre Delisle, Jan Luehe, Kin-man Chung servlet 3.0 JSP plugin, tld cache etc
|
方法摘要 |
String[] |
getLocation(String uri)
Gets the 'location' of the TLD associated with the given taglib 'uri'. |
void |
onStartup(Set<Class<?>> c,
ServletContext ctxt)
Notifies this ServletContainerInitializer of the startup
of the application represented by the given ServletContext. |
static int |
uriType(String uri)
Returns the type of a URI:
ABS_URI
ROOT_REL_URI
NOROOT_REL_URI |
| 从类 java.lang.Object 继承的方法 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ABS_URI
public static final int ABS_URI
- The types of URI one may specify for a tag library
- 另请参见:
- 常量字段值
ROOT_REL_URI
public static final int ROOT_REL_URI
- 另请参见:
- 常量字段值
NOROOT_REL_URI
public static final int NOROOT_REL_URI
- 另请参见:
- 常量字段值
TldScanner
public TldScanner()
- Default Constructor.
This is only used for implementing ServletContainerInitializer.
ServletContext will be supplied in the method onStartUp;
TldScanner
public TldScanner(ServletContext ctxt,
boolean isValidationEnabled)
- Constructor used in Jasper
onStartup
public void onStartup(Set<Class<?>> c,
ServletContext ctxt)
throws ServletException
- 从接口
ServletContainerInitializer 复制的描述
- Notifies this ServletContainerInitializer of the startup
of the application represented by the given ServletContext.
If this ServletContainerInitializer is bundled in a JAR
file inside the WEB-INF/lib directory of an application,
its onStartup method will be invoked only once during the
startup of the bundling application. If this
ServletContainerInitializer is bundled inside a JAR file
outside of any WEB-INF/lib directory, but still
discoverable as described above, its onStartup method
will be invoked every time an application is started.
- 指定者:
- 接口
ServletContainerInitializer 中的 onStartup
- 参数:
c - the Set of application classes that extend, implement, or
have been annotated with the class types specified by the
HandlesTypes annotation,
or null if there are no matches, or this
ServletContainerInitializer has not been annotated with
HandlesTypesctxt - the ServletContext of the web application that
is being started and in which the classes contained in c
were found
- 抛出:
ServletException - if an error has occurred
getLocation
public String[] getLocation(String uri)
throws JasperException
- Gets the 'location' of the TLD associated with the given taglib 'uri'.
Returns null if the uri is not associated with any tag library 'exposed'
in the web application. A tag library is 'exposed' either explicitly in
web.xml or implicitly via the uri tag in the TLD of a taglib deployed
in a jar file (WEB-INF/lib).
- 参数:
uri - The taglib uri
- 返回:
- An array of two Strings: The first element denotes the real
path to the TLD. If the path to the TLD points to a jar file, then the
second element denotes the name of the TLD entry in the jar file.
Returns null if the uri is not associated with any tag library 'exposed'
in the web application.
This method may be called when the scanning is in one of states:
1. Called from jspc script, then a full tld scan is required.
2. The is the first call after servlet initialization, then system jars
that are knwon to have tlds but not listeners need to be scanned.
3. Sebsequent calls, no need to scans.
- 抛出:
JasperException
uriType
public static int uriType(String uri)
- Returns the type of a URI:
ABS_URI
ROOT_REL_URI
NOROOT_REL_URI
Copyright © 2013. All Rights Reserved.