javajspbuilder.java
来自「RESIN 3.2 最新源码」· Java 代码 · 共 698 行 · 第 1/2 页
JAVA
698 行
CustomSimpleTag customTag = new CustomSimpleTag(); customTag.setGenerator(_gen); customTag.setParseState(_parseState); customTag.setQName(qname); customTag.setParent(_currentNode); customTag.setTagInfo(tagInfo); customTag.setTagClass(tagClass); _openNode = customTag; _openNode.setStartLocation(_sourcePath, _filename, _line); } else throw _gen.error(L.l("<{0}>: tag class {0} must either implement Tag or SimpleTag.", qname.getName(), tagClass.getName())); } /** * Starts a prefix mapping. * * @param prefix the xml prefix * @param uri the namespace uri */ public void startPrefixMapping(String prefix, String uri) throws JspParseException { getParseState().pushNamespace(prefix, uri); _gen.addOptionalTaglib(prefix, uri); } /** * Adds an attribute to the element. * * @param name the attribute name * @param value the attribute value */ public void attribute(QName name, String value) throws JspParseException { _openNode.addAttribute(name, value); } /** * Called when the attributes end. */ public void endAttributes() throws JspParseException { _currentNode.addChild(_openNode); _currentNode = _openNode; _currentNode.setNamespace(_parseState.getNamespaces()); _currentNode.endAttributes(); _currentNode.setEndAttributeLocation(_filename, _line); } /** * Ends an element. * * @param qname the name of the element to end */ public void endElement(String name) throws JspParseException { if (! _currentNode.getTagName().equals(name)) { throw error(L.l("Close tag </{0}> does not match the current tag, <{1}>.", name, _currentNode.getTagName())); } try { JspNode node = _currentNode; _currentNode = node.getParent(); node.setEndLocation(_filename, _line); node.endElement(); _currentNode.addChildEnd(node); } catch (JspLineParseException e) { throw e; } catch (JspParseException e) { throw error(e); } catch (Exception e) { throw new JspParseException(e); } } /** * Adds text. * * @param text the text to add */ public void text(String text) throws JspParseException { if (_currentNode != null) { JspNode node = _currentNode.addText(text); if (node != null) { node.setStartLocation(_sourcePath, _filename, _line); } } } /** * Adds text. * * @param text the text to add */ public void text(String text, String srcFilename, int startLine, int endLine) throws JspParseException { if (_currentNode != null) { JspNode node = _currentNode.addText(text); if (node != null) { node.setStartLocation(null, srcFilename, startLine); node.setEndLocation(srcFilename, endLine); } } } /** * Returns the current node. */ public JspNode getCurrentNode() { return _currentNode; } public JspParseException error(String message) { return new JspLineParseException(_filename + ":" + _line + ": " + message + _gen.getSourceLines(_sourcePath, _line)); } public JspParseException error(Throwable e) { if (e instanceof LineCompileException) return new JspLineParseException(e); else if (e instanceof CompileException) return new JspLineParseException(_filename + ":" + _line + ": " + e.getMessage() + _gen.getSourceLines(_sourcePath, _line), e); else return new JspLineParseException(_filename + ":" + _line + ": " + String.valueOf(e) + _gen.getSourceLines(_sourcePath, _line), e); } private static void addMap(HashMap<QName,Class> map, String prefix, String localName, String uri, Class cl) { map.put(new QName(prefix, localName, uri), cl); map.put(new QName(prefix, localName, "urn:jsptld:" + uri), cl); } static { _tagMap = new HashMap<QName,Class>(); addMap(_tagMap, "jsp", "root", JspNode.JSP_NS, JspRoot.class); addMap(_tagMap, "jsp", "directive.page", JspNode.JSP_NS, JspDirectivePage.class); addMap(_tagMap, "jsp", "directive.include", JspNode.JSP_NS, JspDirectiveInclude.class); addMap(_tagMap, "jsp", "directive.cache", JspNode.JSP_NS, NullTag.class); addMap(_tagMap, "jsp", "directive.taglib", JspNode.JSP_NS, JspDirectiveTaglib.class); addMap(_tagMap, "jsp", "directive.attribute", JspNode.JSP_NS, JspDirectiveAttribute.class); addMap(_tagMap, "jsp", "directive.variable", JspNode.JSP_NS, JspDirectiveVariable.class); addMap(_tagMap, "jsp", "directive.tag", JspNode.JSP_NS, JspDirectiveTag.class); addMap(_tagMap, "jsp", "expression", JspNode.JSP_NS, JspExpression.class); addMap(_tagMap, "jsp", "scriptlet", JspNode.JSP_NS, JspScriptlet.class); addMap(_tagMap, "jsp", "declaration", JspNode.JSP_NS, JspDeclaration.class); addMap(_tagMap, "jsp", "useBean", JspNode.JSP_NS, JspUseBean.class); addMap(_tagMap, "jsp", "getProperty", JspNode.JSP_NS, JspGetProperty.class); addMap(_tagMap, "jsp", "setProperty", JspNode.JSP_NS, JspSetProperty.class); addMap(_tagMap, "jsp", "include", JspNode.JSP_NS, JspInclude.class); addMap(_tagMap, "jsp", "forward", JspNode.JSP_NS, JspForward.class); addMap(_tagMap, "jsp", "param", JspNode.JSP_NS, JspParam.class); addMap(_tagMap, "jsp", "plugin", JspNode.JSP_NS, JspPlugin.class); addMap(_tagMap, "jsp", "params", JspNode.JSP_NS, JspParams.class); addMap(_tagMap, "jsp", "fallback", JspNode.JSP_NS, JspFallback.class); addMap(_tagMap, "jsp", "attribute", JspNode.JSP_NS, JspAttribute.class); addMap(_tagMap, "jsp", "doBody", JspNode.JSP_NS, JspDoBody.class); addMap(_tagMap, "jsp", "invoke", JspNode.JSP_NS, JspInvoke.class); addMap(_tagMap, "jsp", "body", JspNode.JSP_NS, JspBody.class); addMap(_tagMap, "jsp", "text", JspNode.JSP_NS, JspText.class); addMap(_tagMap, "jsp", "element", JspNode.JSP_NS, JspElement.class); addMap(_tagMap, "jsp", "output", JspNode.JSP_NS, JspOutput.class); _fastTagMap = new HashMap<QName,Class>(_tagMap); // shortcut addMap(_fastTagMap, "resin-c", "out", JSTL_CORE_URI, JstlCoreOut.class); addMap(_fastTagMap, "resin-c", "out", JSTL_RT_CORE_URI, JstlCoreOut.class); addMap(_fastTagMap, "resin-c", "out", JSTL_EL_CORE_URI, JstlCoreOut.class); addMap(_fastTagMap, "resin-c", "set", JSTL_CORE_URI, JstlCoreSet.class); addMap(_fastTagMap, "resin-c", "set", JSTL_EL_CORE_URI, JstlCoreSet.class); addMap(_fastTagMap, "resin-c", "set", JSTL_RT_CORE_URI, JstlCoreSet.class); addMap(_fastTagMap, "resin-c", "remove", JSTL_CORE_URI, JstlCoreRemove.class); addMap(_fastTagMap, "resin-c", "remove", JSTL_EL_CORE_URI, JstlCoreRemove.class); addMap(_fastTagMap, "resin-c", "remove", JSTL_RT_CORE_URI, JstlCoreRemove.class); addMap(_fastTagMap, "resin-c", "catch", JSTL_CORE_URI, JstlCoreCatch.class); addMap(_fastTagMap, "resin-c", "catch", JSTL_EL_CORE_URI, JstlCoreCatch.class); addMap(_fastTagMap, "resin-c", "catch", JSTL_RT_CORE_URI, JstlCoreCatch.class); addMap(_fastTagMap, "resin-c", "if", JSTL_CORE_URI, JstlCoreIf.class); addMap(_fastTagMap, "resin-c", "if", JSTL_EL_CORE_URI, JstlCoreIf.class); addMap(_fastTagMap, "resin-c", "if", JSTL_RT_CORE_URI, JstlCoreIf.class); addMap(_fastTagMap, "resin-c", "choose", JSTL_CORE_URI, JstlCoreChoose.class); addMap(_fastTagMap, "resin-c", "choose", JSTL_EL_CORE_URI, JstlCoreChoose.class); addMap(_fastTagMap, "resin-c", "choose", JSTL_RT_CORE_URI, JstlCoreChoose.class); addMap(_fastTagMap, "resin-c", "when", JSTL_CORE_URI, JstlCoreWhen.class); addMap(_fastTagMap, "resin-c", "when", JSTL_EL_CORE_URI, JstlCoreWhen.class); addMap(_fastTagMap, "resin-c", "when", JSTL_RT_CORE_URI, JstlCoreWhen.class); addMap(_fastTagMap, "resin-c", "otherwise", JSTL_CORE_URI, JstlCoreOtherwise.class); addMap(_fastTagMap, "resin-c", "otherwise", JSTL_EL_CORE_URI, JstlCoreOtherwise.class); addMap(_fastTagMap, "resin-c", "otherwise", JSTL_RT_CORE_URI, JstlCoreOtherwise.class); addMap(_fastTagMap, "resin-c", "forEach", JSTL_CORE_URI, JstlCoreForEach.class); addMap(_fastTagMap, "resin-c", "forEach", JSTL_EL_CORE_URI, JstlCoreForEach.class); addMap(_fastTagMap, "resin-c", "forEach", JSTL_RT_CORE_URI, JstlCoreForEach.class); addMap(_fastTagMap, "resin-fmt", "message", JSTL_FMT_URI, JstlFmtMessage.class); addMap(_fastTagMap, "resin-fmt", "message", JSTL_EL_FMT_URI, JstlFmtMessage.class); addMap(_fastTagMap, "resin-fmt", "message", JSTL_RT_FMT_URI, JstlFmtMessage.class); addMap(_fastTagMap, "resin-fmt", "setBundle", JSTL_FMT_URI, JstlFmtSetBundle.class); addMap(_fastTagMap, "resin-fmt", "setBundle", JSTL_EL_FMT_URI, JstlFmtSetBundle.class); addMap(_fastTagMap, "resin-fmt", "setBundle", JSTL_RT_FMT_URI, JstlFmtSetBundle.class); addMap(_fastTagMap, "resin-fmt", "bundle", JSTL_FMT_URI, JstlFmtBundle.class); addMap(_fastTagMap, "resin-fmt", "bundle", JSTL_EL_FMT_URI, JstlFmtBundle.class); addMap(_fastTagMap, "resin-fmt", "bundle", JSTL_RT_FMT_URI, JstlFmtBundle.class); addMap(_fastTagMap, "resin-fmt", "param", JSTL_FMT_URI, JstlFmtParam.class); addMap(_fastTagMap, "resin-fmt", "param", JSTL_EL_FMT_URI, JstlFmtParam.class); addMap(_fastTagMap, "resin-fmt", "param", JSTL_RT_FMT_URI, JstlFmtParam.class); addMap(_fastTagMap, "resin-xml", "out", JSTL_XML_URI, JstlXmlOut.class); addMap(_fastTagMap, "resin-xml", "out", JSTL_RT_XML_URI, JstlXmlOut.class); addMap(_fastTagMap, "resin-xml", "out", JSTL_EL_XML_URI, JstlXmlOut.class); addMap(_fastTagMap, "resin-xml", "set", JSTL_XML_URI, JstlXmlSet.class); addMap(_fastTagMap, "resin-xml", "set", JSTL_RT_XML_URI, JstlXmlSet.class); addMap(_fastTagMap, "resin-xml", "set", JSTL_EL_XML_URI, JstlXmlSet.class); addMap(_fastTagMap, "resin-xml", "if", JSTL_XML_URI, JstlXmlIf.class); addMap(_fastTagMap, "resin-xml", "if", JSTL_RT_XML_URI, JstlXmlIf.class); addMap(_fastTagMap, "resin-xml", "if", JSTL_EL_XML_URI, JstlXmlIf.class); addMap(_fastTagMap, "resin-xml", "choose", JSTL_XML_URI, JstlCoreChoose.class); addMap(_fastTagMap, "resin-xml", "choose", JSTL_RT_XML_URI, JstlCoreChoose.class); addMap(_fastTagMap, "resin-xml", "choose", JSTL_EL_XML_URI, JstlCoreChoose.class); addMap(_fastTagMap, "resin-xml", "when", JSTL_XML_URI, JstlXmlWhen.class); addMap(_fastTagMap, "resin-xml", "when", JSTL_RT_XML_URI, JstlXmlWhen.class); addMap(_fastTagMap, "resin-xml", "when", JSTL_EL_XML_URI, JstlXmlWhen.class); addMap(_fastTagMap, "resin-xml", "otherwise", JSTL_XML_URI, JstlCoreOtherwise.class); addMap(_fastTagMap, "resin-xml", "otherwise", JSTL_RT_XML_URI, JstlCoreOtherwise.class); addMap(_fastTagMap, "resin-xml", "otherwise", JSTL_EL_XML_URI, JstlCoreOtherwise.class); _jsfTagMap = new HashMap<QName,Class>(); addMap(_jsfTagMap, "faces", "facet", JSF_CORE_URI, JsfFacetNode.class); addMap(_jsfTagMap, "faces", "view", JSF_CORE_URI, JsfViewRoot.class); addMap(_jsfTagMap, "faces", "phaseListener", JSF_CORE_URI, JsfPhaseListener.class); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?