private void processTldsInFileSystem(String startPath) throws JasperException { Set dirList = ctxt.getResourcePaths(startPath); if (dirList != null) { Iterator it = dirList.iterator(); while (it.hasNext()) { String path = (String) it.next(); if (path.endsWith("/")) { processTldsInFileSystem(path); } if (!path.endsWith(".tld")) { continue; } if (path.startsWith("/WEB-INF/tags/") && !path.endsWith("implicit.tld")) { throw new JasperException( Localizer.getMessage( "jsp.error.tldinit.tldInWebInfTags", path)); } InputStream stream = ctxt.getResourceAsStream(path); TldInfo tldInfo = scanTld(path, null, stream); // Add listeners or to map tldlocations for this TLD if (scanListeners) { addListener(tldInfo, true); } mapTldLocation(path, tldInfo, true); } } }
private void scanTlds() throws JasperException { mappings = new HashMap<String, String[]>(); try { processWebDotXml(); scanJars(); processTldsInFileSystem("/WEB-INF/"); } catch (JasperException ex) { throw ex; } catch (Exception ex) { throw new JasperException( Localizer.getMessage("jsp.error.internal.tldinit"), ex); } }
tldMap = getTldListenerMap(); } else { tldMap= getTldMap(); addManifestClassPath(null, extraJars, jconn); scanJar(jconn, null, isLocal); JarURLConnection jconn = (JarURLConnection) jarURL.openConnection(); if (addManifestClassPath(extraJars,newJars,jconn)){ scanJar(jconn, null, true); for (URI uri : tldMap.keySet()) { URL jarURL = new URL("jar:" + uri.toString() + "!/"); scanJar((JarURLConnection)jarURL.openConnection(), tldMap.get(uri), false);
JarEntry entry = jarFile.getJarEntry(tldName); InputStream stream = jarFile.getInputStream(entry); tldInfoA.add(scanTld(resourcePath, tldName, stream)); if (!name.endsWith(".tld")) continue; InputStream stream = jarFile.getInputStream(entry); tldInfoA.add(scanTld(resourcePath, name, stream)); addListener(tldInfo, isLocal); mapTldLocation(resourcePath, tldInfo, isLocal);
/** * 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). * * @param uri The taglib uri * * @return 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. */ public String[] getLocation(String uri) throws JasperException { if (mappings == null) { mappings = (HashMap<String, String[]>) ctxt.getAttribute( Constants.JSP_TLD_URI_TO_LOCATION_MAP); if (mappings == null) { scanListeners = false; scanTlds(); } } return (String[]) mappings.get(uri); }
private void initServletContext() { try { context =new JspCServletContext (new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")), new URL("file:" + uriRoot.replace('\\','/') + '/')); tldScanner = new TldScanner(context, isValidationEnabled); // START GlassFish 750 taglibs = new ConcurrentHashMap<String, TagLibraryInfo>(); context.setAttribute(Constants.JSP_TAGLIBRARY_CACHE, taglibs); tagFileJarUrls = new ConcurrentHashMap<String, URL>(); context.setAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE, tagFileJarUrls); // END GlassFish 750 } catch (MalformedURLException me) { System.out.println("**" + me); } catch (UnsupportedEncodingException ex) { } rctxt = new JspRuntimeContext(context, this); jspConfig = new JspConfig(context); tagPluginManager = new TagPluginManager(context); }
/** * Gets the 'location' of the TLD associated with the given taglib 'uri'. * * @return 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 given uri is not associated with any tag library * 'exposed' in the web application. */ public String[] getTldLocation(String uri) throws JasperException { String[] location = getOptions().getTldScanner().getLocation(uri); return location; }
URLConnection conn = urls[i].openConnection(); if (conn instanceof JarURLConnection) { scanJar((JarURLConnection) conn, null, isLocal); } else { String urlStr = urls[i].toString(); && urlStr.endsWith(JAR_FILE_SUFFIX)) { URL jarURL = new URL("jar:" + urlStr + "!/"); scanJar((JarURLConnection) jarURL.openConnection(), null, isLocal); for (URI uri : tldMap.keySet()) { URL jarURL = new URL("jar:" + uri.toString() + "!/"); scanJar((JarURLConnection)jarURL.openConnection(), tldMap.get(uri), false);
JarEntry entry = jarFile.getJarEntry(tldName); InputStream stream = jarFile.getInputStream(entry); tldInfoA.add(scanTld(resourcePath, tldName, stream)); if (!name.endsWith(".tld")) continue; InputStream stream = jarFile.getInputStream(entry); tldInfoA.add(scanTld(resourcePath, name, stream)); addListener(tldInfo, isLocal); mapTldLocation(resourcePath, tldInfo, isLocal);
scanTlds(); doneScanning = true;
private void initServletContext() { try { context =new JspCServletContext (new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")), new URL("file:" + uriRoot.replace('\\','/') + '/')); tldScanner = new TldScanner(context, isValidationEnabled); // START GlassFish 750 taglibs = new ConcurrentHashMap<String, TagLibraryInfo>(); context.setAttribute(Constants.JSP_TAGLIBRARY_CACHE, taglibs); tagFileJarUrls = new ConcurrentHashMap<String, URL>(); context.setAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE, tagFileJarUrls); // END GlassFish 750 } catch (MalformedURLException me) { System.out.println("**" + me); } catch (UnsupportedEncodingException ex) { } rctxt = new JspRuntimeContext(context, this); jspConfig = new JspConfig(context); tagPluginManager = new TagPluginManager(context); }
/** * Gets the 'location' of the TLD associated with the given taglib 'uri'. * * @return 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 given uri is not associated with any tag library * 'exposed' in the web application. */ public String[] getTldLocation(String uri) throws JasperException { String[] location = getOptions().getTldScanner().getLocation(uri); return location; }
private void processTldsInFileSystem(String startPath) throws JasperException { Set dirList = ctxt.getResourcePaths(startPath); if (dirList != null) { Iterator it = dirList.iterator(); while (it.hasNext()) { String path = (String) it.next(); if (path.endsWith("/")) { processTldsInFileSystem(path); } if (!path.endsWith(".tld")) { continue; } if (path.startsWith("/WEB-INF/tags/") && !path.endsWith("implicit.tld")) { throw new JasperException( Localizer.getMessage( "jsp.error.tldinit.tldInWebInfTags", path)); } InputStream stream = ctxt.getResourceAsStream(path); TldInfo tldInfo = scanTld(path, null, stream); // Add listeners or to map tldlocations for this TLD if (scanListeners) { addListener(tldInfo, true); } mapTldLocation(path, tldInfo, true); } } }
tldMap = getTldListenerMap(); } else { tldMap= getTldMap(); addManifestClassPath(null, extraJars, jconn); scanJar(jconn, null, isLocal); JarURLConnection jconn = (JarURLConnection) jarURL.openConnection(); if (addManifestClassPath(extraJars,newJars,jconn)){ scanJar(jconn, null, true); for (URI uri : tldMap.keySet()) { URL jarURL = new URL("jar:" + uri.toString() + "!/"); scanJar((JarURLConnection)jarURL.openConnection(), tldMap.get(uri), false);
/** * Scan the all the tlds accessible in the web app. * For performance reasons, this is done in two stages. At servlet * initialization time, we only scan the jar files for listeners. The * container passes a list of system jar files that are known to contain * tlds with listeners. The rest of the jar files will be scanned when * a JSP page with a tld referenced is compiled. */ private void scanTlds() throws JasperException { mappings = new HashMap<String, String[]>(); // Make a local copy of the system jar cache jarTldCacheLocal.putAll(jarTldCache); try { processWebDotXml(); scanJars(); processTldsInFileSystem("/WEB-INF/"); } catch (JasperException ex) { throw ex; } catch (Exception ex) { throw new JasperException( Localizer.getMessage("jsp.error.internal.tldinit"), ex); } }
JarEntry entry = jarFile.getJarEntry(tldName); InputStream stream = jarFile.getInputStream(entry); tldInfoA.add(scanTld(resourcePath, tldName, stream)); if (!name.endsWith(".tld")) continue; InputStream stream = jarFile.getInputStream(entry); tldInfoA.add(scanTld(resourcePath, name, stream)); addListener(tldInfo, isLocal); mapTldLocation(resourcePath, tldInfo, isLocal);
public void onStartup(java.util.Set<java.lang.Class<?>> c, ServletContext ctxt) throws ServletException { this.ctxt = ctxt; Boolean b = (Boolean) ctxt.getAttribute("com.sun.faces.useMyFaces"); if (b != null) { useMyFaces = b.booleanValue(); } ServletRegistration reg = ctxt.getServletRegistration("jsp"); if (reg == null) { return; } String validating = reg.getInitParameter("validating"); isValidationEnabled = "true".equals(validating); scanListeners = true; scanTlds(); ctxt.setAttribute(Constants.JSP_TLD_URI_TO_LOCATION_MAP, mappings); }
private void initServletContext() { try { context =new JspCServletContext (new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")), new URL("file:" + uriRoot.replace('\\','/') + '/')); tldScanner = new TldScanner(context, isValidationEnabled); // START GlassFish 750 taglibs = new ConcurrentHashMap<String, TagLibraryInfo>(); context.setAttribute(Constants.JSP_TAGLIBRARY_CACHE, taglibs); tagFileJarUrls = new ConcurrentHashMap<String, URL>(); context.setAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE, tagFileJarUrls); // END GlassFish 750 } catch (MalformedURLException me) { System.out.println("**" + me); } catch (UnsupportedEncodingException ex) { } rctxt = new JspRuntimeContext(context, this); jspConfig = new JspConfig(context); tagPluginManager = new TagPluginManager(context); }
/** * Gets the 'location' of the TLD associated with the given taglib 'uri'. * * @return 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 given uri is not associated with any tag library * 'exposed' in the web application. */ public String[] getTldLocation(String uri) throws JasperException { String[] location = getOptions().getTldScanner().getLocation(uri); return location; }
private void processTldsInFileSystem(String startPath) throws JasperException { Set dirList = ctxt.getResourcePaths(startPath); if (dirList != null) { Iterator it = dirList.iterator(); while (it.hasNext()) { String path = (String) it.next(); if (path.endsWith("/")) { processTldsInFileSystem(path); } if (!path.endsWith(".tld")) { continue; } if (path.startsWith("/WEB-INF/tags/") && !path.endsWith("implicit.tld")) { throw new JasperException( Localizer.getMessage( "jsp.error.tldinit.tldInWebInfTags", path)); } InputStream stream = ctxt.getResourceAsStream(path); TldInfo tldInfo = scanTld(path, null, stream); // Add listeners or to map tldlocations for this TLD if (scanListeners) { addListener(tldInfo, true); } mapTldLocation(path, tldInfo, true); } } }