public class TldScanner
extends java.lang.Object
implements javax.servlet.ServletContainerInitializer
Modifier and Type | Class and Description |
---|---|
(package private) static class |
TldScanner.TldInfo |
Modifier and Type | Field and Description |
---|---|
static int |
ABS_URI
The types of URI one may specify for a tag library
|
private boolean |
blockExternal |
private javax.servlet.ServletContext |
ctxt |
private boolean |
doneScanning |
private static java.lang.String |
EAR_LIB_CLASSLOADER |
private static java.lang.String |
FILE_PROTOCOL |
private static java.lang.String |
IS_STANDALONE_ATTRIBUTE_NAME |
private boolean |
isValidationEnabled |
private static java.lang.String |
JAR_FILE_SUFFIX |
private static java.util.Map<java.lang.String,TldScanner.TldInfo[]> |
jarTldCache |
private java.util.Map<java.lang.String,TldScanner.TldInfo[]> |
jarTldCacheLocal
A local cache for keeping track which jars have been scanned.
|
private static java.util.logging.Logger |
log |
private java.util.HashMap<java.lang.String,java.lang.String[]> |
mappings
The mapping of the 'global' tag library URI (as defined in the tld) to
the location (resource path) of the TLD associated with that tag library.
|
static int |
NOROOT_REL_URI |
static int |
ROOT_REL_URI |
private boolean |
scanListeners |
private static java.util.HashSet<java.lang.String> |
systemUris |
private static java.util.HashSet<java.lang.String> |
systemUrisJsf |
private boolean |
useMyFaces |
private static java.lang.String |
WEB_XML |
Constructor and Description |
---|
TldScanner()
Default Constructor.
|
TldScanner(javax.servlet.ServletContext ctxt,
boolean isValidationEnabled)
Constructor used in Jasper
|
Modifier and Type | Method and Description |
---|---|
private void |
addListener(TldScanner.TldInfo tldInfo,
boolean isLocal) |
private boolean |
addManifestClassPath(java.util.List<java.lang.String> scannedJars,
java.util.List<java.lang.String> newJars,
java.net.JarURLConnection jconn) |
java.lang.String[] |
getLocation(java.lang.String uri)
Gets the 'location' of the TLD associated with the given taglib 'uri'.
|
(package private) java.util.Map<java.net.URI,java.util.List<java.lang.String>> |
getTldListenerMap() |
(package private) java.util.Map<java.net.URI,java.util.List<java.lang.String>> |
getTldMap() |
private void |
mapTldLocation(java.lang.String resourcePath,
TldScanner.TldInfo tldInfo,
boolean isLocal) |
void |
onStartup(java.util.Set<java.lang.Class<?>> c,
javax.servlet.ServletContext ctxt) |
private void |
processTldsInFileSystem(java.lang.String startPath) |
private void |
processWebDotXml() |
private void |
scanJar(java.net.JarURLConnection conn,
java.util.List<java.lang.String> tldNames,
boolean isLocal)
Scans the given JarURLConnection for TLD files located in META-INF
(or a subdirectory of it).
|
private void |
scanJars() |
private TldScanner.TldInfo |
scanTld(java.lang.String resourcePath,
java.lang.String entryName,
java.io.InputStream stream)
Scan the given TLD for uri and listeners elements.
|
private void |
scanTlds()
Scan the all the tlds accessible in the web app.
|
static int |
uriType(java.lang.String uri)
Returns the type of a URI:
ABS_URI
ROOT_REL_URI
NOROOT_REL_URI
|
private static java.util.logging.Logger log
public static final int ABS_URI
public static final int ROOT_REL_URI
public static final int NOROOT_REL_URI
private static final java.lang.String WEB_XML
private static final java.lang.String FILE_PROTOCOL
private static final java.lang.String JAR_FILE_SUFFIX
private static java.util.HashSet<java.lang.String> systemUris
private static java.util.HashSet<java.lang.String> systemUrisJsf
private static java.util.Map<java.lang.String,TldScanner.TldInfo[]> jarTldCache
private static final java.lang.String EAR_LIB_CLASSLOADER
private static final java.lang.String IS_STANDALONE_ATTRIBUTE_NAME
private java.util.HashMap<java.lang.String,java.lang.String[]> mappings
private java.util.Map<java.lang.String,TldScanner.TldInfo[]> jarTldCacheLocal
private javax.servlet.ServletContext ctxt
private boolean isValidationEnabled
private boolean useMyFaces
private boolean scanListeners
private boolean doneScanning
private boolean blockExternal
public TldScanner()
public TldScanner(javax.servlet.ServletContext ctxt, boolean isValidationEnabled)
public void onStartup(java.util.Set<java.lang.Class<?>> c, javax.servlet.ServletContext ctxt) throws javax.servlet.ServletException
onStartup
in interface javax.servlet.ServletContainerInitializer
javax.servlet.ServletException
public java.lang.String[] getLocation(java.lang.String uri) throws JasperException
uri
- The taglib uriJasperException
java.util.Map<java.net.URI,java.util.List<java.lang.String>> getTldMap()
java.util.Map<java.net.URI,java.util.List<java.lang.String>> getTldListenerMap()
public static int uriType(java.lang.String uri)
private void scanTlds() throws JasperException
JasperException
private void processWebDotXml() throws java.lang.Exception
java.lang.Exception
private void scanJar(java.net.JarURLConnection conn, java.util.List<java.lang.String> tldNames, boolean isLocal) throws JasperException
conn
- The JarURLConnection to the JAR file to scantldNames
- the list of tld element to scan. The null value
indicates all the tlds in this case.isLocal
- True if the jar file is under WEB-INF
false otherwiseJasperException
private void addListener(TldScanner.TldInfo tldInfo, boolean isLocal)
private void mapTldLocation(java.lang.String resourcePath, TldScanner.TldInfo tldInfo, boolean isLocal)
private void processTldsInFileSystem(java.lang.String startPath) throws JasperException
JasperException
private TldScanner.TldInfo scanTld(java.lang.String resourcePath, java.lang.String entryName, java.io.InputStream stream) throws JasperException
resourcePath
- the resource path for the jar file or the tld file.entryName
- If the resource path is a jar file, then the name of
the tld file in the jar, else should be null.stream
- The input stream for the tldJasperException
private void scanJars() throws java.lang.Exception
java.lang.Exception
private boolean addManifestClassPath(java.util.List<java.lang.String> scannedJars, java.util.List<java.lang.String> newJars, java.net.JarURLConnection jconn)