• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ParserUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.jasper.xmlparser.ParserUtils的典型用法代码示例。如果您正苦于以下问题:Java ParserUtils类的具体用法?Java ParserUtils怎么用?Java ParserUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParserUtils类属于org.apache.jasper.xmlparser包,在下文中一共展示了ParserUtils类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getUriFromTld

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private String getUriFromTld(String resourcePath, InputStream in) 
    throws JasperException
{
    // Parse the tag library descriptor at the specified resource path
    TreeNode tld = new ParserUtils().parseXMLDocument(resourcePath, in);
    TreeNode uri = tld.findChild("uri");
    if (uri != null) {
        String body = uri.getBody();
        if (body != null)
            return body;
    }

    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:TldLocationsCache.java


示例2: tldScanStream

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void tldScanStream(String resourcePath, String entryName, InputStream stream) throws IOException {
	try {
		// Parse the tag library descriptor at the specified resource path
		String uri = null;

		boolean validate = Boolean.parseBoolean(ctxt.getInitParameter(Constants.XML_VALIDATION_TLD_INIT_PARAM));
		String blockExternalString = ctxt.getInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
		boolean blockExternal;
		if (blockExternalString == null) {
			blockExternal = true;
		} else {
			blockExternal = Boolean.parseBoolean(blockExternalString);
		}

		ParserUtils pu = new ParserUtils(validate, blockExternal);
		TreeNode tld = pu.parseXMLDocument(resourcePath, stream);
		TreeNode uriNode = tld.findChild("uri");
		if (uriNode != null) {
			String body = uriNode.getBody();
			if (body != null)
				uri = body;
		}

		// Add implicit map entry only if its uri is not already
		// present in the map
		if (uri != null && mappings.get(uri) == null) {
			TldLocation location;
			if (entryName == null) {
				location = new TldLocation(resourcePath);
			} else {
				location = new TldLocation(entryName, resourcePath);
			}
			mappings.put(uri, location);
		}
	} catch (JasperException e) {
		// Hack - makes exception handling simpler
		throw new IOException(e);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:40,代码来源:TldLocationsCache.java


示例3: tldScanStream

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void tldScanStream(String resourcePath, String entryName,
        InputStream stream) throws IOException {
    try {
        // Parse the tag library descriptor at the specified resource path
        String uri = null;

        TreeNode tld =
            new ParserUtils().parseXMLDocument(resourcePath, stream);
        TreeNode uriNode = tld.findChild("uri");
        if (uriNode != null) {
            String body = uriNode.getBody();
            if (body != null)
                uri = body;
        }

        // Add implicit map entry only if its uri is not already
        // present in the map
        if (uri != null && mappings.get(uri) == null) {
            TldLocation location;
            if (entryName == null) {
                location = new TldLocation(resourcePath);
            } else {
                location = new TldLocation(entryName, resourcePath);
            }
            mappings.put(uri, location);
        }
    } catch (JasperException e) {
        // Hack - makes exception handling simpler
        throw new IOException(e);
    }
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:32,代码来源:TldLocationsCache.java


示例4: tldScanWebXml

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void tldScanWebXml() throws Exception {

        WebXml webXml = null;
        try {
            webXml = new WebXml(ctxt);
            if (webXml.getInputSource() == null) {
                return;
            }

            boolean validate = Boolean.parseBoolean(
                    ctxt.getInitParameter(
                            Constants.XML_VALIDATION_INIT_PARAM));
            String blockExternalString = ctxt.getInitParameter(
                    Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
            boolean blockExternal;
            if (blockExternalString == null) {
                blockExternal = true;
            } else {
                blockExternal = Boolean.parseBoolean(blockExternalString);
            }
            
            // Parse the web application deployment descriptor
            ParserUtils pu = new ParserUtils(validate, blockExternal);
            
            TreeNode webtld = null;
            webtld = pu.parseXMLDocument(webXml.getSystemId(),
                    webXml.getInputSource());

            // Allow taglib to be an element of the root or jsp-config (JSP2.0)
            TreeNode jspConfig = webtld.findChild("jsp-config");
            if (jspConfig != null) {
                webtld = jspConfig;
            }
            Iterator<TreeNode> taglibs = webtld.findChildren("taglib");
            while (taglibs.hasNext()) {

                // Parse the next <taglib> element
                TreeNode taglib = taglibs.next();
                String tagUri = null;
                String tagLoc = null;
                TreeNode child = taglib.findChild("taglib-uri");
                if (child != null)
                    tagUri = child.getBody();
                child = taglib.findChild("taglib-location");
                if (child != null)
                    tagLoc = child.getBody();

                // Save this location if appropriate
                if (tagLoc == null)
                    continue;
                if (uriType(tagLoc) == NOROOT_REL_URI)
                    tagLoc = "/WEB-INF/" + tagLoc;
                TldLocation location;
                if (tagLoc.endsWith(JAR_EXT)) {
                    location = new TldLocation("META-INF/taglib.tld", ctxt.getResource(tagLoc).toString());
                } else {
                    location = new TldLocation(tagLoc);
                }
                mappings.put(tagUri, location);
            }
        } finally {
            if (webXml != null) {
                webXml.close();
            }
        }
    }
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:67,代码来源:TldLocationsCache.java


示例5: tldScanStream

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void tldScanStream(String resourcePath, String entryName,
        InputStream stream) throws IOException {
    try {
        // Parse the tag library descriptor at the specified resource path
        String uri = null;

        boolean validate = Boolean.parseBoolean(
                ctxt.getInitParameter(
                        Constants.XML_VALIDATION_TLD_INIT_PARAM));
        String blockExternalString = ctxt.getInitParameter(
                Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
        boolean blockExternal;
        if (blockExternalString == null) {
            blockExternal = true;
        } else {
            blockExternal = Boolean.parseBoolean(blockExternalString);
        }
        
        ParserUtils pu = new ParserUtils(validate, blockExternal); 
        TreeNode tld = pu.parseXMLDocument(resourcePath, stream);
        TreeNode uriNode = tld.findChild("uri");
        if (uriNode != null) {
            String body = uriNode.getBody();
            if (body != null)
                uri = body;
        }

        // Add implicit map entry only if its uri is not already
        // present in the map
        if (uri != null && mappings.get(uri) == null) {
            TldLocation location;
            if (entryName == null) {
                location = new TldLocation(resourcePath);
            } else {
                location = new TldLocation(entryName, resourcePath);
            }
            mappings.put(uri, location);
        }
    } catch (JasperException e) {
        // Hack - makes exception handling simpler
        throw new IOException(e);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:44,代码来源:TldLocationsCache.java


示例6: tldScanWebXml

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void tldScanWebXml() throws Exception {

		WebXml webXml = null;
		try {
			webXml = new WebXml(ctxt);
			if (webXml.getInputSource() == null) {
				return;
			}

			boolean validate = Boolean.parseBoolean(ctxt.getInitParameter(Constants.XML_VALIDATION_INIT_PARAM));
			String blockExternalString = ctxt.getInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
			boolean blockExternal;
			if (blockExternalString == null) {
				blockExternal = true;
			} else {
				blockExternal = Boolean.parseBoolean(blockExternalString);
			}

			// Parse the web application deployment descriptor
			ParserUtils pu = new ParserUtils(validate, blockExternal);

			TreeNode webtld = null;
			webtld = pu.parseXMLDocument(webXml.getSystemId(), webXml.getInputSource());

			// Allow taglib to be an element of the root or jsp-config (JSP2.0)
			TreeNode jspConfig = webtld.findChild("jsp-config");
			if (jspConfig != null) {
				webtld = jspConfig;
			}
			Iterator<TreeNode> taglibs = webtld.findChildren("taglib");
			while (taglibs.hasNext()) {

				// Parse the next <taglib> element
				TreeNode taglib = taglibs.next();
				String tagUri = null;
				String tagLoc = null;
				TreeNode child = taglib.findChild("taglib-uri");
				if (child != null)
					tagUri = child.getBody();
				child = taglib.findChild("taglib-location");
				if (child != null)
					tagLoc = child.getBody();

				// Save this location if appropriate
				if (tagLoc == null)
					continue;
				if (uriType(tagLoc) == NOROOT_REL_URI)
					tagLoc = "/WEB-INF/" + tagLoc;
				TldLocation location;
				if (tagLoc.endsWith(JAR_EXT)) {
					location = new TldLocation("META-INF/taglib.tld", ctxt.getResource(tagLoc).toString());
				} else {
					location = new TldLocation(tagLoc);
				}
				mappings.put(tagUri, location);
			}
		} finally {
			if (webXml != null) {
				webXml.close();
			}
		}
	}
 
开发者ID:how2j,项目名称:lazycat,代码行数:63,代码来源:TldLocationsCache.java


示例7: processWebDotXml

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void processWebDotXml() throws Exception {
    InputStream is = null;
    try {
        // Acquire input stream to web application deployment descriptor
        String altDDName = (String)ctxt.getAttribute(Constants.ALT_DD_ATTR);
        URL uri = null;
        if (altDDName != null) {
            try {
                uri = new URL(FILE_PROTOCOL+altDDName.replace('\\', '/'));
            } catch (MalformedURLException e) {
                if (logger.isWarnEnabled()) {
                    logger.warn(Localizer.getMessage(
                                        "jsp.error.internal.filenotfound",
                                        altDDName));
                }
            }
        } else {
            uri = ctxt.getResource(WEB_XML);
            if (uri == null && logger.isWarnEnabled()) {
                logger.warn(Localizer.getMessage(
                                        "jsp.error.internal.filenotfound",
                                        WEB_XML));
            }
        }

        if (uri == null) {
            return;
        }
        is = uri.openStream();
        InputSource ip = new InputSource(is);
        ip.setSystemId(uri.toExternalForm()); 

        // Parse the web application deployment descriptor
        TreeNode webtld = null;
        // altDDName is the absolute path of the DD
        if (altDDName != null) {
            webtld = new ParserUtils().parseXMLDocument(altDDName, ip);
        } else {
            webtld = new ParserUtils().parseXMLDocument(WEB_XML, ip);
        }

        // Allow taglib to be an element of the root or jsp-config (JSP2.0)
        TreeNode jspConfig = webtld.findChild("jsp-config");
        if (jspConfig != null) {
            webtld = jspConfig;
        }
        Iterator<?> taglibs = webtld.findChildren("taglib");
        while (taglibs.hasNext()) {

            // Parse the next <taglib> element
            TreeNode taglib = (TreeNode) taglibs.next();
            String tagUri = null;
            String tagLoc = null;
            TreeNode child = taglib.findChild("taglib-uri");
            if (child != null)
                tagUri = child.getBody();
            child = taglib.findChild("taglib-location");
            if (child != null)
                tagLoc = child.getBody();

            // Save this location if appropriate
            if (tagLoc == null)
                continue;
            if (uriType(tagLoc) == NOROOT_REL_URI)
                tagLoc = "/WEB-INF/" + tagLoc;
            String tagLoc2 = null;
            if (tagLoc.endsWith(JAR_FILE_SUFFIX)) {
                tagLoc = ctxt.getResource(tagLoc).toString();
                tagLoc2 = "META-INF/taglib.tld";
            }
            mappings.put(tagUri, new String[] { tagLoc, tagLoc2 });
        }
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (Throwable t) {}
        }
    }
}
 
开发者ID:balancebeam,项目名称:puzzle,代码行数:81,代码来源:PluginTldLocationsCache.java


示例8: processPluginWebDotXml

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void  processPluginWebDotXml(PluginContext ctx) throws Exception{
	  InputStream is = null;
      try {
    	  URL urlDefault = ctx.findLocalResource("WEB-INF/web.xml");
    	  if (urlDefault == null) {
              return;
          }
          is = urlDefault.openStream();
          InputSource ip = new InputSource(is);
          ip.setSystemId(urlDefault.toExternalForm()); 
          // Parse the web application deployment descriptor
          TreeNode webtld = null;
          webtld = new ParserUtils().parseXMLDocument(WEB_XML, ip);
          // Allow taglib to be an element of the root or jsp-config (JSP2.0)
          TreeNode jspConfig = webtld.findChild("jsp-config");
          if (jspConfig != null) {
              webtld = jspConfig;
          }
          Iterator<?> taglibs = webtld.findChildren("taglib");
          while (taglibs.hasNext()) {
              // Parse the next <taglib> element
              TreeNode taglib = (TreeNode) taglibs.next();
              String tagUri = null;
              String tagLoc = null;
              TreeNode child = taglib.findChild("taglib-uri");
              if (child != null)
                  tagUri = child.getBody();
              child = taglib.findChild("taglib-location");
              if (child != null)
                tagLoc = child.getBody();
                String resourcePath ="/"+ctx.getName()+tagLoc;
                Map<String,String[]> tldMapping= (Map<String,String[]>)ctx.getAttribute("tld-mapping");
            	  tldMapping.put(tagUri, new String[] {resourcePath, tagLoc});
            	if(logger.isDebugEnabled()){
            		logger.debug("完成解析组件"+ctx.getName()+"web.xml中的tld配置");
            	}
          }
      } finally {
          if (is != null) {
              try {
                  is.close();
              } catch (Throwable t) {}
          }
      }
}
 
开发者ID:balancebeam,项目名称:puzzle,代码行数:46,代码来源:PluginTldLocationsCache.java


示例9: setSchemaResourcePrefix

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
/**
 * Sets the path prefix for .xsd resources
 */
public static void setSchemaResourcePrefix(String prefix) {
    ParserUtils.setSchemaResourcePrefix(prefix);
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:7,代码来源:JspC.java


示例10: setDtdResourcePrefix

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
/**
 * Sets the path prefix for .dtd resources
 */
public static void setDtdResourcePrefix(String prefix) {
    ParserUtils.setDtdResourcePrefix(prefix);
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:7,代码来源:JspC.java


示例11: scanTld

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
/**
 * Scan the given TLD for uri and listeners elements.
 *
 * @param resourcePath the resource path for the jar file or the tld file.
 * @param entryName If the resource path is a jar file, then the name of
 *        the tld file in the jar, else should be null.
 * @param stream The input stream for the tld
 * @return The TldInfo for this tld
 */
private TldInfo scanTld(String resourcePath, String entryName,
                     InputStream stream)
            throws JasperException {
    try {
        // Parse the tag library descriptor at the specified resource path
        TreeNode tld = new ParserUtils().parseXMLDocument(
                            resourcePath, stream, isValidationEnabled);

        String uri = null;
        TreeNode uriNode = tld.findChild("uri");
        if (uriNode != null) {
            uri = uriNode.getBody();
        }

        ArrayList<String> listeners = new ArrayList<String>();

        Iterator<TreeNode>listenerNodes = tld.findChildren("listener");
        while (listenerNodes.hasNext()) {
            TreeNode listener = listenerNodes.next();
            TreeNode listenerClass = listener.findChild("listener-class");
            if (listenerClass != null) {
                String listenerClassName = listenerClass.getBody();
                if (listenerClassName != null) {
                    listeners.add(listenerClassName);
                }
            }
        }

        return new TldInfo(uri, entryName,
                           listeners.toArray(new String[listeners.size()]));

    } finally {
        if (stream != null) {
            try {
                stream.close();
            } catch (Throwable t) {
                // do nothing
            }
        }
    }
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:51,代码来源:TldScanner.java


示例12: parseImplicitTld

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
/**
 * Parses the JSP version and tlib-version from the implicit.tld at the
 * given path.
 */
private void parseImplicitTld(JspCompilationContext ctxt, String path)
        throws JasperException {

    InputStream is = null;
    TreeNode tld = null;

    try {
        URL uri = ctxt.getResource(path);
        if (uri == null) {
            // no implicit.tld
            return;
        }

        is = uri.openStream();
        /* SJSAS 6384538
        tld = new ParserUtils().parseXMLDocument(IMPLICIT_TLD, is);
        */
        // START SJSAS 6384538
        tld = new ParserUtils().parseXMLDocument(
            IMPLICIT_TLD, is, ctxt.getOptions().isValidationEnabled());
        // END SJSAS 6384538
    } catch (Exception ex) {
        throw new JasperException(ex);
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (Throwable t) {}
        }
    }

    this.jspversion = tld.findAttribute("version");

    Iterator list = tld.findChildren();
    while (list.hasNext()) {
        TreeNode element = (TreeNode) list.next();
        String tname = element.getName();
        if ("tlibversion".equals(tname)
                || "tlib-version".equals(tname)) {
            this.tlibversion = element.getBody();
        } else if ("jspversion".equals(tname)
                || "jsp-version".equals(tname)) {
            this.jspversion = element.getBody();
        } else if (!"shortname".equals(tname)
                && !"short-name".equals(tname)) {
            err.jspError("jsp.error.implicitTld.additionalElements",
                         path, tname);
        }
    }

    // JSP version in implicit.tld must be 2.0 or greater
    Double jspVersionDouble = Double.valueOf(this.jspversion);
    if (Double.compare(jspVersionDouble, Constants.JSP_VERSION_2_0) < 0) {
        err.jspError("jsp.error.implicitTld.jspVersion", path,
                     this.jspversion);
    }
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:62,代码来源:ImplicitTagLibraryInfo.java


示例13: init

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void init(ErrorDispatcher err) throws JasperException {
if (initialized)
    return;

InputStream is = ctxt.getResourceAsStream(TAG_PLUGINS_XML);
if (is == null)
    return;

TreeNode root = (new ParserUtils()).parseXMLDocument(TAG_PLUGINS_XML,
						     is);
if (root == null) {
    return;
}

if (!TAG_PLUGINS_ROOT_ELEM.equals(root.getName())) {
    err.jspError("jsp.error.plugin.wrongRootElement", TAG_PLUGINS_XML,
		 TAG_PLUGINS_ROOT_ELEM);
}

tagPlugins = new HashMap<String, TagPlugin>();
Iterator pluginList = root.findChildren("tag-plugin");
while (pluginList.hasNext()) {
    TreeNode pluginNode = (TreeNode) pluginList.next();
           TreeNode tagClassNode = pluginNode.findChild("tag-class");
    if (tagClassNode == null) {
	// Error
	return;
    }
    String tagClass = tagClassNode.getBody().trim();
    TreeNode pluginClassNode = pluginNode.findChild("plugin-class");
    if (pluginClassNode == null) {
	// Error
	return;
    }

    String pluginClassStr = pluginClassNode.getBody();
    TagPlugin tagPlugin = null;
    try {
	Class<? extends TagPlugin> pluginClass =
                   Class.forName(pluginClassStr).asSubclass(TagPlugin.class);
	tagPlugin =  pluginClass.newInstance();
    } catch (Exception e) {
	throw new JasperException(e);
    }
    if (tagPlugin == null) {
	return;
    }
    tagPlugins.put(tagClass, tagPlugin);
}
initialized = true;
   }
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:52,代码来源:TagPluginManager.java


示例14: scanTld

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
/**
 * Scan the given TLD for uri and listeners elements.
 *
 * @param resourcePath the resource path for the jar file or the tld file.
 * @param entryName If the resource path is a jar file, then the name of
 *        the tld file in the jar, else should be null.
 * @param stream The input stream for the tld
 * @return The TldInfo for this tld
 */
private TldInfo scanTld(String resourcePath, String entryName,
                     InputStream stream)
            throws JasperException {
    try {
        // Parse the tag library descriptor at the specified resource path
        TreeNode tld = new ParserUtils(blockExternal).parseXMLDocument(
                            resourcePath, stream, isValidationEnabled);

        String uri = null;
        TreeNode uriNode = tld.findChild("uri");
        if (uriNode != null) {
            uri = uriNode.getBody();
        }

        ArrayList<String> listeners = new ArrayList<String>();

        Iterator<TreeNode>listenerNodes = tld.findChildren("listener");
        while (listenerNodes.hasNext()) {
            TreeNode listener = listenerNodes.next();
            TreeNode listenerClass = listener.findChild("listener-class");
            if (listenerClass != null) {
                String listenerClassName = listenerClass.getBody();
                if (listenerClassName != null) {
                    listeners.add(listenerClassName);
                }
            }
        }

        return new TldInfo(uri, entryName,
                           listeners.toArray(new String[listeners.size()]));

    } finally {
        if (stream != null) {
            try {
                stream.close();
            } catch (Throwable t) {
                // do nothing
            }
        }
    }
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:51,代码来源:TldScanner.java


示例15: parseImplicitTld

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
/**
 * Parses the JSP version and tlib-version from the implicit.tld at the
 * given path.
 */
private void parseImplicitTld(JspCompilationContext ctxt, String path)
        throws JasperException {

    InputStream is = null;
    TreeNode tld = null;

    try {
        URL uri = ctxt.getResource(path);
        if (uri == null) {
            // no implicit.tld
            return;
        }

        is = uri.openStream();
        /* SJSAS 6384538
        tld = new ParserUtils().parseXMLDocument(IMPLICIT_TLD, is);
        */
        // START SJSAS 6384538
        boolean blockExternal = Boolean.parseBoolean(ctxt.getServletContext()
               .getInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM));
        tld = new ParserUtils(blockExternal).parseXMLDocument(
            IMPLICIT_TLD, is, ctxt.getOptions().isValidationEnabled());
        // END SJSAS 6384538
    } catch (Exception ex) {
        throw new JasperException(ex);
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (Throwable t) {}
        }
    }

    this.jspversion = tld.findAttribute("version");

    Iterator list = tld.findChildren();
    while (list.hasNext()) {
        TreeNode element = (TreeNode) list.next();
        String tname = element.getName();
        if ("tlibversion".equals(tname)
                || "tlib-version".equals(tname)) {
            this.tlibversion = element.getBody();
        } else if ("jspversion".equals(tname)
                || "jsp-version".equals(tname)) {
            this.jspversion = element.getBody();
        } else if (!"shortname".equals(tname)
                && !"short-name".equals(tname)) {
            err.jspError("jsp.error.implicitTld.additionalElements",
                         path, tname);
        }
    }

    // JSP version in implicit.tld must be 2.0 or greater
    Double jspVersionDouble = Double.valueOf(this.jspversion);
    if (Double.compare(jspVersionDouble, Constants.JSP_VERSION_2_0) < 0) {
        err.jspError("jsp.error.implicitTld.jspVersion", path,
                     this.jspversion);
    }
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:64,代码来源:ImplicitTagLibraryInfo.java


示例16: init

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void init(ErrorDispatcher err) throws JasperException {
if (initialized)
    return;

InputStream is = ctxt.getResourceAsStream(TAG_PLUGINS_XML);
if (is == null)
    return;

       boolean blockExternal = Boolean.parseBoolean(ctxt.getInitParameter(
                                   Constants.XML_BLOCK_EXTERNAL_INIT_PARAM));
TreeNode root = (new ParserUtils(blockExternal)).parseXMLDocument(TAG_PLUGINS_XML,
						     is);
if (root == null) {
    return;
}

if (!TAG_PLUGINS_ROOT_ELEM.equals(root.getName())) {
    err.jspError("jsp.error.plugin.wrongRootElement", TAG_PLUGINS_XML,
		 TAG_PLUGINS_ROOT_ELEM);
}

tagPlugins = new HashMap<String, TagPlugin>();
Iterator pluginList = root.findChildren("tag-plugin");
while (pluginList.hasNext()) {
    TreeNode pluginNode = (TreeNode) pluginList.next();
           TreeNode tagClassNode = pluginNode.findChild("tag-class");
    if (tagClassNode == null) {
	// Error
	return;
    }
    String tagClass = tagClassNode.getBody().trim();
    TreeNode pluginClassNode = pluginNode.findChild("plugin-class");
    if (pluginClassNode == null) {
	// Error
	return;
    }

    String pluginClassStr = pluginClassNode.getBody();
    TagPlugin tagPlugin = null;
    try {
	Class<? extends TagPlugin> pluginClass =
                   Class.forName(pluginClassStr).asSubclass(TagPlugin.class);
	tagPlugin =  pluginClass.newInstance();
    } catch (Exception e) {
	throw new JasperException(e);
    }
    if (tagPlugin == null) {
	return;
    }
    tagPlugins.put(tagClass, tagPlugin);
}
initialized = true;
   }
 
开发者ID:ctron,项目名称:package-drone,代码行数:54,代码来源:TagPluginManager.java


示例17: tldScanWebXml

import org.apache.jasper.xmlparser.ParserUtils; //导入依赖的package包/类
private void tldScanWebXml() throws Exception {

        WebXml webXml = null;
        try {
            webXml = new WebXml(ctxt);
            if (webXml.getInputSource() == null) {
                return;
            }

            // Parse the web application deployment descriptor
            TreeNode webtld = null;
            webtld = new ParserUtils().parseXMLDocument(webXml.getSystemId(),
                    webXml.getInputSource());

            // Allow taglib to be an element of the root or jsp-config (JSP2.0)
            TreeNode jspConfig = webtld.findChild("jsp-config");
            if (jspConfig != null) {
                webtld = jspConfig;
            }
            Iterator<TreeNode> taglibs = webtld.findChildren("taglib");
            while (taglibs.hasNext()) {

                // Parse the next <taglib> element
                TreeNode taglib = taglibs.next();
                String tagUri = null;
                String tagLoc = null;
                TreeNode child = taglib.findChild("taglib-uri");
                if (child != null)
                    tagUri = child.getBody();
                child = taglib.findChild("taglib-location");
                if (child != null)
                    tagLoc = child.getBody();

                // Save this location if appropriate
                if (tagLoc == null)
                    continue;
                if (uriType(tagLoc) == NOROOT_REL_URI)
                    tagLoc = "/WEB-INF/" + tagLoc;
                TldLocation location;
                if (tagLoc.endsWith(JAR_EXT)) {
                    location = new TldLocation("META-INF/taglib.tld", ctxt.getResource(tagLoc).toString());
                } else {
                    location = new TldLocation(tagLoc);
                }
                mappings.put(tagUri, location);
            }
        } finally {
            if (webXml != null) {
                webXml.close();
            }
        }
    }
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:53,代码来源:TldLocationsCache.java



注:本文中的org.apache.jasper.xmlparser.ParserUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Locator类代码示例发布时间:2022-05-22
下一篇:
Java HttpMethodName类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap