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


Java TagFileInfo类代码示例

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


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

示例1: CustomTag

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
public CustomTag(String qName, String prefix, String localName,
        String uri, Attributes attrs, Attributes nonTaglibXmlnsAttrs,
        Attributes taglibAttrs, Mark start, Node parent,
        TagFileInfo tagFileInfo) {

    super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
            start, parent);

    this.uri = uri;
    this.prefix = prefix;
    this.tagFileInfo = tagFileInfo;
    this.tagInfo = tagFileInfo.getTagInfo();
    this.customNestingLevel = makeCustomNestingLevel();
    this.childInfo = new ChildInfo();

    this.implementsIterationTag = false;
    this.implementsBodyTag = false;
    this.implementsTryCatchFinally = false;
    this.implementsSimpleTag = true;
    this.implementsJspIdConsumer = false;
    this.implementsDynamicAttributes = tagInfo.hasDynamicAttributes();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:23,代码来源:Node.java

示例2: visit

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
public void visit(Node.CustomTag n) throws JasperException {
    TagFileInfo tagFileInfo = n.getTagFileInfo();
    if (tagFileInfo != null) {
        String tagFilePath = tagFileInfo.getPath();
        if (tagFilePath.startsWith("/META-INF/")) {
            // For tags in JARs, add the TLD and the tag as a dependency
            String[] location =
                compiler.getCompilationContext().getTldLocation(
                        tagFileInfo.getTagInfo().getTagLibrary().getURI());
            // Add TLD
            pageInfo.addDependant("jar:" + location[0] + "!/" +
                    location[1]);
            // Add Tag
            pageInfo.addDependant("jar:" + location[0] + "!" +
                    tagFilePath);
        } else {
            pageInfo.addDependant(tagFilePath);
        }
        Class c = loadTagFile(compiler, tagFilePath, n.getTagInfo(),
                pageInfo);
        n.setTagHandlerClass(c);
    }
    visitBody(n);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:TagFileProcessor.java

示例3: CustomTag

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
public CustomTag(String qName, String prefix, String localName, String uri, Attributes attrs,
		Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start, Node parent,
		TagFileInfo tagFileInfo) {

	super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs, start, parent);

	this.uri = uri;
	this.prefix = prefix;
	this.tagFileInfo = tagFileInfo;
	this.tagInfo = tagFileInfo.getTagInfo();
	this.customNestingLevel = makeCustomNestingLevel();
	this.childInfo = new ChildInfo();

	this.implementsIterationTag = false;
	this.implementsBodyTag = false;
	this.implementsTryCatchFinally = false;
	this.implementsSimpleTag = true;
	this.implementsJspIdConsumer = false;
	this.implementsDynamicAttributes = tagInfo.hasDynamicAttributes();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:21,代码来源:Node.java

示例4: CustomTag

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
public CustomTag(String jspVersion,
                        String qName, String prefix, String localName,
		 String uri, Attributes attrs,
		 Attributes nonTaglibXmlnsAttrs,
		 Attributes taglibAttrs,
		 Mark start, Node parent, TagFileInfo tagFileInfo) {

           super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
                 start, parent);

           this.jspVersion = Double.valueOf(jspVersion).doubleValue();
    this.uri = uri;
    this.prefix = prefix;
    this.tagFileInfo = tagFileInfo;
    this.tagInfo = tagFileInfo.getTagInfo();
    this.customNestingLevel = makeCustomNestingLevel();
           this.childInfo = new ChildInfo();

    this.implementsIterationTag = false;
    this.implementsBodyTag = false;
    this.implementsTryCatchFinally = false;
    this.implementsSimpleTag = true;
    this.implementsDynamicAttributes = tagInfo.hasDynamicAttributes();
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:25,代码来源:Node.java

示例5: visit

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
public void visit(Node.CustomTag n) throws JasperException {
          TagFileInfo tagFileInfo = n.getTagFileInfo();
          if (tagFileInfo != null) {
              String tagFilePath = tagFileInfo.getPath();
              if (tagFilePath.startsWith("/META-INF/")) {
                  // For tags in JARs, add the TLD and the tag as a dependency
                  String[] location =
                      compiler.getCompilationContext().getTldLocation(
                          tagFileInfo.getTagInfo().getTagLibrary().getURI());
                  // Add TLD
                  pageInfo.addDependant("jar:" + location[0] + "!/" +
                          location[1]);
                  // Add Tag
                  pageInfo.addDependant("jar:" + location[0] + "!" +
                          tagFilePath);
              } else {
                  pageInfo.addDependant(tagFilePath);
}
              Class c = loadTagFile(compiler, tagFilePath, n.getTagInfo(),
                                    pageInfo);
              n.setTagHandlerClass(c);
          }
          visitBody(n);
      }
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:25,代码来源:TagFileProcessor.java

示例6: visit

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
@Override
public void visit(Node.CustomTag n) throws JasperException {
    TagFileInfo tagFileInfo = n.getTagFileInfo();
    if (tagFileInfo != null) {
        String tagFilePath = tagFileInfo.getPath();
        if (tagFilePath.startsWith("/META-INF/")) {
            // For tags in JARs, add the TLD and the tag as a dependency
            TldLocation location =
                compiler.getCompilationContext().getTldLocation(
                    tagFileInfo.getTagInfo().getTagLibrary().getURI());
            JarResource jarResource = location.getJarResource();
            if (jarResource != null) {
                try {
                    // Add TLD
                    pageInfo.addDependant(jarResource.getEntry(location.getName()).toString(),
                            Long.valueOf(jarResource.getJarFile().getEntry(location.getName()).getTime()));
                    // Add Tag
                    pageInfo.addDependant(jarResource.getEntry(tagFilePath.substring(1)).toString(),
                            Long.valueOf(jarResource.getJarFile().getEntry(tagFilePath.substring(1)).getTime()));
                } catch (IOException ioe) {
                    throw new JasperException(ioe);
                }
            }
            else {
                pageInfo.addDependant(tagFilePath,
                        compiler.getCompilationContext().getLastModified(
                                tagFilePath));
            }
        } else {
            pageInfo.addDependant(tagFilePath,
                    compiler.getCompilationContext().getLastModified(
                            tagFilePath));
        }
        Class<?> c = loadTagFile(compiler, tagFilePath, n.getTagInfo(),
                pageInfo);
        n.setTagHandlerClass(c);
    }
    visitBody(n);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:40,代码来源:TagFileProcessor.java

示例7: testBug54240

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
@Test
public void testBug54240() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
    tomcat.start();

    ServletContext context = ctx.getServletContext();

    TagPluginManager manager = new TagPluginManager(context);

    Node.Nodes nodes = new Node.Nodes();
    Node.CustomTag c = new Node.CustomTag("test:ATag", "test", "ATag",
            "http://tomcat.apache.org/jasper", null, null, null, null, null,
            new TagFileInfo("ATag", "http://tomcat.apache.org/jasper",
                    tagInfo));
    c.setTagHandlerClass(TesterTag.class);
    nodes.add(c);
    manager.apply(nodes, null, null);

    Node n = nodes.getNode(0);
    Assert.assertNotNull(n);
    Assert.assertTrue(n instanceof Node.CustomTag);

    Node.CustomTag t = (Node.CustomTag)n;
    Assert.assertNotNull(t.getAtSTag());

    Node.Nodes sTag = c.getAtSTag();
    Node scriptlet = sTag.getNode(0);
    Assert.assertNotNull(scriptlet);
    Assert.assertTrue(scriptlet instanceof Node.Scriptlet);
    Node.Scriptlet s = (Node.Scriptlet)scriptlet;
    Assert.assertEquals("//Just a comment", s.getText());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:36,代码来源:TestTagPluginManager.java

示例8: getTagFile

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
/**
 * Get the TagFileInfo for a given tag name, looking through all the
 * tag files in this tag library.
 *
 * @param shortname The short name (no prefix) of the tag
 * @return the TagFileInfo for the specified Tag file, or null
 *         if no Tag file is found
 * @since JSP 2.0
 */
public TagFileInfo getTagFile(String shortname) {
    TagFileInfo tagFiles[] = getTagFiles();

    if (tagFiles == null || tagFiles.length == 0) {
        return null;
    }

    for (int i=0; i < tagFiles.length; i++) {
        if (tagFiles[i].getName().equals(shortname)) {
            return tagFiles[i];
        }
    }
    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:TagLibraryInfo.java

示例9: parseCustomAction

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
private Node parseCustomAction(String qName, String localName, String uri, Attributes nonTaglibAttrs,
		Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start, Node parent) throws SAXException {

	// Check if this is a user-defined (custom) tag
	TagLibraryInfo tagLibInfo = pageInfo.getTaglib(uri);
	if (tagLibInfo == null) {
		return null;
	}

	TagInfo tagInfo = tagLibInfo.getTag(localName);
	TagFileInfo tagFileInfo = tagLibInfo.getTagFile(localName);
	if (tagInfo == null && tagFileInfo == null) {
		throw new SAXParseException(Localizer.getMessage("jsp.error.xml.bad_tag", localName, uri), locator);
	}
	Class<?> tagHandlerClass = null;
	if (tagInfo != null) {
		String handlerClassName = tagInfo.getTagClassName();
		try {
			tagHandlerClass = ctxt.getClassLoader().loadClass(handlerClassName);
		} catch (Exception e) {
			throw new SAXParseException(
					Localizer.getMessage("jsp.error.loadclass.taghandler", handlerClassName, qName), locator, e);
		}
	}

	String prefix = getPrefix(qName);

	Node.CustomTag ret = null;
	if (tagInfo != null) {
		ret = new Node.CustomTag(qName, prefix, localName, uri, nonTaglibAttrs, nonTaglibXmlnsAttrs, taglibAttrs,
				start, parent, tagInfo, tagHandlerClass);
	} else {
		ret = new Node.CustomTag(qName, prefix, localName, uri, nonTaglibAttrs, nonTaglibXmlnsAttrs, taglibAttrs,
				start, parent, tagFileInfo);
	}

	return ret;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:39,代码来源:JspDocumentParser.java

示例10: createTagFileInfo

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
private TagFileInfo createTagFileInfo(TreeNode elem, JarResource jarResource) throws JasperException {

		String name = null;
		String path = null;

		Iterator<TreeNode> list = elem.findChildren();
		while (list.hasNext()) {
			TreeNode child = list.next();
			String tname = child.getName();
			if ("name".equals(tname)) {
				name = child.getBody();
			} else if ("path".equals(tname)) {
				path = child.getBody();
			} else if ("example".equals(tname)) {
				// Ignore <example> element: Bugzilla 33538
			} else if ("tag-extension".equals(tname)) {
				// Ignore <tag-extension> element: Bugzilla 33538
			} else if ("icon".equals(tname) || "display-name".equals(tname) || "description".equals(tname)) {
				// Ignore these elements: Bugzilla 38015
			} else {
				if (log.isWarnEnabled()) {
					log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.tagfile", tname));
				}
			}
		}

		if (path.startsWith("/META-INF/tags")) {
			// Tag file packaged in JAR
			// See https://bz.apache.org/bugzilla/show_bug.cgi?id=46471
			// This needs to be removed once all the broken code that depends on
			// it has been removed
			ctxt.setTagFileJarResource(path, jarResource);
		} else if (!path.startsWith("/WEB-INF/tags")) {
			err.jspError("jsp.error.tagfile.illegalPath", path);
		}

		TagInfo tagInfo = TagFileProcessor.parseTagFileDirectives(parserController, name, path, jarResource, this);
		return new TagFileInfo(name, path, tagInfo);
	}
 
开发者ID:how2j,项目名称:lazycat,代码行数:40,代码来源:TagLibraryInfoImpl.java

示例11: visit

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
@Override
public void visit(Node.CustomTag n) throws JasperException {
	TagFileInfo tagFileInfo = n.getTagFileInfo();
	if (tagFileInfo != null) {
		String tagFilePath = tagFileInfo.getPath();
		if (tagFilePath.startsWith("/META-INF/")) {
			// For tags in JARs, add the TLD and the tag as a dependency
			TldLocation location = compiler.getCompilationContext()
					.getTldLocation(tagFileInfo.getTagInfo().getTagLibrary().getURI());
			JarResource jarResource = location.getJarResource();
			if (jarResource != null) {
				try {
					// Add TLD
					pageInfo.addDependant(jarResource.getEntry(location.getName()).toString(),
							Long.valueOf(jarResource.getJarFile().getEntry(location.getName()).getTime()));
					// Add Tag
					pageInfo.addDependant(jarResource.getEntry(tagFilePath.substring(1)).toString(), Long
							.valueOf(jarResource.getJarFile().getEntry(tagFilePath.substring(1)).getTime()));
				} catch (IOException ioe) {
					throw new JasperException(ioe);
				}
			} else {
				pageInfo.addDependant(tagFilePath,
						compiler.getCompilationContext().getLastModified(tagFilePath));
			}
		} else {
			pageInfo.addDependant(tagFilePath, compiler.getCompilationContext().getLastModified(tagFilePath));
		}
		Class<?> c = loadTagFile(compiler, tagFilePath, n.getTagInfo(), pageInfo);
		n.setTagHandlerClass(c);
	}
	visitBody(n);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:34,代码来源:TagFileProcessor.java

示例12: parseCustomAction

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
private Node parseCustomAction(
    String qName,
    String localName,
    String uri,
    Attributes nonTaglibAttrs,
    Attributes nonTaglibXmlnsAttrs,
    Attributes taglibAttrs,
    Mark start,
    Node parent)
    throws SAXException {

    // Check if this is a user-defined (custom) tag
    TagLibraryInfo tagLibInfo = pageInfo.getTaglib(uri);
    if (tagLibInfo == null) {
        return null;
    }

    TagInfo tagInfo = tagLibInfo.getTag(localName);
    TagFileInfo tagFileInfo = tagLibInfo.getTagFile(localName);
    if (tagInfo == null && tagFileInfo == null) {
        throw new SAXParseException(
            Localizer.getMessage("jsp.error.xml.bad_tag", localName, uri),
            locator);
    }
    Class<?> tagHandlerClass = null;
    if (tagInfo != null) {
        String handlerClassName = tagInfo.getTagClassName();
        try {
            tagHandlerClass =
                ctxt.getClassLoader().loadClass(handlerClassName);
        } catch (Exception e) {
            throw new SAXParseException(
                Localizer.getMessage("jsp.error.loadclass.taghandler",
                                     handlerClassName,
                                     qName),
                locator, e);
        }
    }

    String prefix = getPrefix(qName);

    Node.CustomTag ret = null;
    if (tagInfo != null) {
        ret =
            new Node.CustomTag(
                qName,
                prefix,
                localName,
                uri,
                nonTaglibAttrs,
                nonTaglibXmlnsAttrs,
                taglibAttrs,
                start,
                parent,
                tagInfo,
                tagHandlerClass);
    } else {
        ret =
            new Node.CustomTag(
                qName,
                prefix,
                localName,
                uri,
                nonTaglibAttrs,
                nonTaglibXmlnsAttrs,
                taglibAttrs,
                start,
                parent,
                tagFileInfo);
    }

    return ret;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:74,代码来源:JspDocumentParser.java

示例13: parseTaglibDirective

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
private void parseTaglibDirective(Node parent) throws JasperException {

        Attributes attrs = parseAttributes();
        String uri = attrs.getValue("uri");
        String prefix = attrs.getValue("prefix");
        if (prefix != null) {
            Mark prevMark = pageInfo.getNonCustomTagPrefix(prefix);
            if (prevMark != null) {
                err.jspError(reader.mark(), "jsp.error.prefix.use_before_dcl",
                        prefix, prevMark.getFile(), ""
                                + prevMark.getLineNumber());
            }
            if (uri != null) {
                String uriPrev = pageInfo.getURI(prefix);
                if (uriPrev != null && !uriPrev.equals(uri)) {
                    err.jspError(reader.mark(), "jsp.error.prefix.refined",
                            prefix, uri, uriPrev);
                }
                if (pageInfo.getTaglib(uri) == null) {
                    TagLibraryInfoImpl impl = null;
                    if (ctxt.getOptions().isCaching()) {
                        impl = (TagLibraryInfoImpl) ctxt.getOptions()
                                .getCache().get(uri);
                    }
                    if (impl == null) {
                        TldLocation location = ctxt.getTldLocation(uri);
                        impl = new TagLibraryInfoImpl(ctxt, parserController,
                                pageInfo, prefix, uri, location, err,
                                reader.mark());
                        if (ctxt.getOptions().isCaching()) {
                            ctxt.getOptions().getCache().put(uri, impl);
                        }
                    } else {
                        // Current compilation context needs location of cached
                        // tag files
                        for (TagFileInfo info : impl.getTagFiles()) {
                            ctxt.setTagFileJarResource(info.getPath(),
                                    ctxt.getTagFileJarResource());
                        }
                    }
                    pageInfo.addTaglib(uri, impl);
                }
                pageInfo.addPrefixMapping(prefix, uri);
            } else {
                String tagdir = attrs.getValue("tagdir");
                if (tagdir != null) {
                    String urnTagdir = URN_JSPTAGDIR + tagdir;
                    if (pageInfo.getTaglib(urnTagdir) == null) {
                        pageInfo.addTaglib(urnTagdir,
                                new ImplicitTagLibraryInfo(ctxt,
                                        parserController, pageInfo, prefix,
                                        tagdir, err));
                    }
                    pageInfo.addPrefixMapping(prefix, urnTagdir);
                }
            }
        }

        new Node.TaglibDirective(attrs, start, parent);
    }
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:61,代码来源:Parser.java

示例14: getTagFileInfo

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
public TagFileInfo getTagFileInfo() {
    return tagFileInfo;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:4,代码来源:Node.java

示例15: createTagFileInfo

import javax.servlet.jsp.tagext.TagFileInfo; //导入依赖的package包/类
private TagFileInfo createTagFileInfo(TreeNode elem, JarResource jarResource)
        throws JasperException {

    String name = null;
    String path = null;

    Iterator<TreeNode> list = elem.findChildren();
    while (list.hasNext()) {
        TreeNode child = list.next();
        String tname = child.getName();
        if ("name".equals(tname)) {
            name = child.getBody();
        } else if ("path".equals(tname)) {
            path = child.getBody();
        } else if ("example".equals(tname)) {
            // Ignore <example> element: Bugzilla 33538
        } else if ("tag-extension".equals(tname)) {
            // Ignore <tag-extension> element: Bugzilla 33538
        } else if ("icon".equals(tname) 
                || "display-name".equals(tname) 
                || "description".equals(tname)) {
            // Ignore these elements: Bugzilla 38015
        } else {
            if (log.isWarnEnabled()) {
                log.warn(Localizer.getMessage(
                        "jsp.warning.unknown.element.in.tagfile", tname));
            }
        }
    }

    if (path.startsWith("/META-INF/tags")) {
        // Tag file packaged in JAR
        // See https://bz.apache.org/bugzilla/show_bug.cgi?id=46471
        // This needs to be removed once all the broken code that depends on
        // it has been removed
        ctxt.setTagFileJarResource(path, jarResource);
    } else if (!path.startsWith("/WEB-INF/tags")) {
        err.jspError("jsp.error.tagfile.illegalPath", path);
    }

    TagInfo tagInfo = TagFileProcessor.parseTagFileDirectives(
            parserController, name, path, jarResource, this);
    return new TagFileInfo(name, path, tagInfo);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:45,代码来源:TagLibraryInfoImpl.java


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