当前位置: 首页>>代码示例>>Java>>正文


Java XmlErrorHandler.logFindings方法代码示例

本文整理汇总了Java中org.apache.tomcat.util.descriptor.XmlErrorHandler.logFindings方法的典型用法代码示例。如果您正苦于以下问题:Java XmlErrorHandler.logFindings方法的具体用法?Java XmlErrorHandler.logFindings怎么用?Java XmlErrorHandler.logFindings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tomcat.util.descriptor.XmlErrorHandler的用法示例。


在下文中一共展示了XmlErrorHandler.logFindings方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.apache.tomcat.util.descriptor.XmlErrorHandler; //导入方法依赖的package包/类
public void parse(URL url) throws IOException, SAXException {
    try (InputStream is = url.openStream()) {
        XmlErrorHandler handler = new XmlErrorHandler();
        digester.setErrorHandler(handler);

        digester.push(this);

        InputSource source = new InputSource(url.toExternalForm());
        source.setByteStream(is);
        digester.parse(source);
        if (!handler.getWarnings().isEmpty() || !handler.getErrors().isEmpty()) {
            handler.logFindings(log, source.getSystemId());
            if (!handler.getErrors().isEmpty()) {
                // throw the first to indicate there was a error during processing
                throw handler.getErrors().iterator().next();
            }
        }
    } finally {
        digester.reset();
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:22,代码来源:TagPluginParser.java

示例2: tldScanDir

import org.apache.tomcat.util.descriptor.XmlErrorHandler; //导入方法依赖的package包/类
private void tldScanDir(File start) {

        if (log.isTraceEnabled()) {
            log.trace(sm.getString("tldConfig.dirScan", start.getAbsolutePath()));
        }

        File[] fileList = start.listFiles();
        if (fileList != null) {
            for (int i = 0; i < fileList.length; i++) {
                // Scan recursively
                if (fileList[i].isDirectory()) {
                    tldScanDir(fileList[i]);
                } else if (fileList[i].getAbsolutePath().endsWith(TLD_EXT)) {
                    InputStream stream = null;
                    try {
                        stream = new FileInputStream(fileList[i]);
                        XmlErrorHandler handler = tldScanStream(stream);
                        handler.logFindings(log, fileList[i].getAbsolutePath());
                    } catch (IOException ioe) {
                        log.warn(sm.getString("tldConfig.dirFail",
                                fileList[i].getAbsolutePath()),
                                ioe);
                    } finally {
                        if (stream != null) {
                            try {
                                stream.close();
                            } catch (Throwable t) {
                                ExceptionUtils.handleThrowable(t);
                            }
                        }
                    }
                }
            }
        }
    }
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:36,代码来源:TldConfig.java

示例3: tldScanWebXml

import org.apache.tomcat.util.descriptor.XmlErrorHandler; //导入方法依赖的package包/类
/**
 * Get the taglib entries from web.xml and add them to the map.
 * 
 * This is not kept in sync with o.a.j.compiler.TldLocationsCache as this
 * code needs to scan the TLDs listed in web.xml whereas Jasper only needs
 * the URI to TLD mappings.
 */
private void tldScanWebXml() {
    
    if (log.isTraceEnabled()) {
        log.trace(sm.getString("tldConfig.webxmlStart"));
    }

    Collection<TaglibDescriptor> descriptors =
        context.getJspConfigDescriptor().getTaglibs();

    for (TaglibDescriptor descriptor : descriptors) {
        String resourcePath = descriptor.getTaglibLocation();
        // Note: Whilst the Servlet 2.4 DTD implies that the location must
        // be a context-relative path starting with '/', JSP.7.3.6.1 states
        // explicitly how paths that do not start with '/' should be
        // handled.
        if (!resourcePath.startsWith("/")) {
            resourcePath = WEB_INF + resourcePath;
        }
        if (taglibUris.contains(descriptor.getTaglibURI())) {
            log.warn(sm.getString("tldConfig.webxmlSkip", resourcePath,
                    descriptor.getTaglibURI()));
        } else {
            if (log.isTraceEnabled()) {
                log.trace(sm.getString("tldConfig.webxmlAdd", resourcePath,
                        descriptor.getTaglibURI()));
            }
            InputStream stream = null;
            try {
                stream = context.getServletContext().getResourceAsStream(
                        resourcePath);
                if (stream != null) {
                    XmlErrorHandler handler = tldScanStream(stream);
                    handler.logFindings(log, resourcePath);
                    taglibUris.add(descriptor.getTaglibURI());
                    webxmlTaglibUris.add(descriptor.getTaglibURI());
                } else {
                    log.warn(sm.getString("tldConfig.webxmlFailPathDoesNotExist", resourcePath,
                            descriptor.getTaglibURI()));
                }
            } catch (IOException ioe) {
                log.warn(sm.getString("tldConfig.webxmlFail", resourcePath,
                        descriptor.getTaglibURI()), ioe);
            } finally {
                if (stream != null) {
                    try {
                        stream.close();
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                    }
                }
            }
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:62,代码来源:TldConfig.java

示例4: tldScanResourcePaths

import org.apache.tomcat.util.descriptor.XmlErrorHandler; //导入方法依赖的package包/类
private void tldScanResourcePaths(String startPath) {

        if (log.isTraceEnabled()) {
            log.trace(sm.getString("tldConfig.webinfScan", startPath));
        }

        ServletContext ctxt = context.getServletContext();

        Set<String> dirList = ctxt.getResourcePaths(startPath);
        if (dirList != null) {
            Iterator<String> it = dirList.iterator();
            while (it.hasNext()) {
                String path = it.next();
                if (!path.endsWith(TLD_EXT)
                        && (path.startsWith(WEB_INF_LIB)
                                || path.startsWith("/WEB-INF/classes/"))) {
                    continue;
                }
                if (path.endsWith(TLD_EXT)) {
                    if (path.startsWith("/WEB-INF/tags/") &&
                            !path.endsWith("implicit.tld")) {
                        continue;
                    }
                    InputStream stream = ctxt.getResourceAsStream(path);
                    try {
                        XmlErrorHandler handler = tldScanStream(stream);
                        handler.logFindings(log, path);
                    } catch (IOException ioe) {
                        log.warn(sm.getString("tldConfig.webinfFail", path),
                                ioe);
                    } finally {
                        if (stream != null) {
                            try {
                                stream.close();
                            } catch (Throwable t) {
                                ExceptionUtils.handleThrowable(t);
                            }
                        }
                    }
                } else {
                    tldScanResourcePaths(path);
                }
            }
        }
    }
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:46,代码来源:TldConfig.java

示例5: tldScanWebXml

import org.apache.tomcat.util.descriptor.XmlErrorHandler; //导入方法依赖的package包/类
/**
 * Get the taglib entries from web.xml and add them to the map.
 * 
 * This is not kept in sync with o.a.j.compiler.TldLocationsCache as this
 * code needs to scan the TLDs listed in web.xml whereas Jasper only needs
 * the URI to TLD mappings.
 */
private void tldScanWebXml() {

	if (log.isTraceEnabled()) {
		log.trace(sm.getString("tldConfig.webxmlStart"));
	}

	Collection<TaglibDescriptor> descriptors = context.getJspConfigDescriptor().getTaglibs();

	for (TaglibDescriptor descriptor : descriptors) {
		String resourcePath = descriptor.getTaglibLocation();
		// Note: Whilst the Servlet 2.4 DTD implies that the location must
		// be a context-relative path starting with '/', JSP.7.3.6.1 states
		// explicitly how paths that do not start with '/' should be
		// handled.
		if (!resourcePath.startsWith("/")) {
			resourcePath = WEB_INF + resourcePath;
		}
		if (taglibUris.contains(descriptor.getTaglibURI())) {
			log.warn(sm.getString("tldConfig.webxmlSkip", resourcePath, descriptor.getTaglibURI()));
		} else {
			if (log.isTraceEnabled()) {
				log.trace(sm.getString("tldConfig.webxmlAdd", resourcePath, descriptor.getTaglibURI()));
			}
			InputStream stream = null;
			try {
				stream = context.getServletContext().getResourceAsStream(resourcePath);
				if (stream != null) {
					XmlErrorHandler handler = tldScanStream(stream);
					handler.logFindings(log, resourcePath);
					taglibUris.add(descriptor.getTaglibURI());
					webxmlTaglibUris.add(descriptor.getTaglibURI());
				} else {
					log.warn(sm.getString("tldConfig.webxmlFailPathDoesNotExist", resourcePath,
							descriptor.getTaglibURI()));
				}
			} catch (IOException ioe) {
				log.warn(sm.getString("tldConfig.webxmlFail", resourcePath, descriptor.getTaglibURI()), ioe);
			} finally {
				if (stream != null) {
					try {
						stream.close();
					} catch (Throwable t) {
						ExceptionUtils.handleThrowable(t);
					}
				}
			}
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:57,代码来源:TldConfig.java

示例6: tldScanResourcePaths

import org.apache.tomcat.util.descriptor.XmlErrorHandler; //导入方法依赖的package包/类
private void tldScanResourcePaths(String startPath) {

		if (log.isTraceEnabled()) {
			log.trace(sm.getString("tldConfig.webinfScan", startPath));
		}

		ServletContext ctxt = context.getServletContext();

		Set<String> dirList = ctxt.getResourcePaths(startPath);
		if (dirList != null) {
			Iterator<String> it = dirList.iterator();
			while (it.hasNext()) {
				String path = it.next();
				if (!path.endsWith(TLD_EXT) && (path.startsWith(WEB_INF_LIB) || path.startsWith("/WEB-INF/classes/"))) {
					continue;
				}
				if (path.endsWith(TLD_EXT)) {
					if (path.startsWith("/WEB-INF/tags/") && !path.endsWith("implicit.tld")) {
						continue;
					}
					InputStream stream = ctxt.getResourceAsStream(path);
					try {
						XmlErrorHandler handler = tldScanStream(stream);
						handler.logFindings(log, path);
					} catch (IOException ioe) {
						log.warn(sm.getString("tldConfig.webinfFail", path), ioe);
					} finally {
						if (stream != null) {
							try {
								stream.close();
							} catch (Throwable t) {
								ExceptionUtils.handleThrowable(t);
							}
						}
					}
				} else {
					tldScanResourcePaths(path);
				}
			}
		}
	}
 
开发者ID:how2j,项目名称:lazycat,代码行数:42,代码来源:TldConfig.java


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