javax.servlet.jsp.tagext.TagInfo Java Examples
The following examples show how to use
javax.servlet.jsp.tagext.TagInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JspServletWrapper.java From Tomcat8-Source-Read with MIT License | 6 votes |
public JspServletWrapper(ServletContext servletContext, Options options, String tagFilePath, TagInfo tagInfo, JspRuntimeContext rctxt, Jar tagJar) { this.isTagFile = true; this.config = null; // not used this.options = options; this.jspUri = tagFilePath; this.tripCount = 0; unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false; unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false; unloadAllowed = unloadByCount || unloadByIdle ? true : false; ctxt = new JspCompilationContext(jspUri, tagInfo, options, servletContext, this, rctxt, tagJar); }
Example #2
Source File: JspCompletionQuery.java From netbeans with Apache License 2.0 | 6 votes |
/** Gets a list of JSP directives which can be completed just after <% in java scriptlet context */ private void queryJspDirectiveInScriptlet(CompletionResultSet result, int offset, JspSyntaxSupport sup) throws BadLocationException { TokenItem item = sup.getItemAtOrBefore(offset); if (item == null) { return; } TokenID id = item.getTokenID(); String tokenPart = item.getImage().substring(0, offset - item.getOffset()); if(id == JspTagTokenContext.SYMBOL2 && tokenPart.equals("<%")) { addDirectiveItems(result, offset - tokenPart.length(), (List<TagInfo>)sup.getDirectives("")); // NOI18N } }
Example #3
Source File: JspHyperlinkProvider.java From netbeans with Apache License 2.0 | 6 votes |
private FileObject getTagFile(TokenSequence<?> tokenSequence, JspSyntaxSupport jspSup) { Token token = tokenSequence.token(); if (token.id() == JspTokenId.TAG) { String image = token.text().toString().trim(); if (image.startsWith("<")) { // NOI18N image = image.substring(1).trim(); } if (!image.startsWith("jsp:") && image.indexOf(':') != -1) { // NOI18N List l = jspSup.getTags(image); if (l.size() == 1) { TagLibraryInfo libInfo = ((TagInfo) l.get(0)).getTagLibrary(); if (libInfo != null) { TagFileInfo fileInfo = libInfo.getTagFile(getTagName(image)); if (fileInfo != null) { return JspUtils.getFileObject(jspSup.getDocument(), fileInfo.getPath()); } } } } } return null; }
Example #4
Source File: JspServletWrapper.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
public JspServletWrapper(ServletContext servletContext, Options options, String tagFilePath, TagInfo tagInfo, JspRuntimeContext rctxt, JarResource tagJarResource) { this.isTagFile = true; this.config = null; // not used this.options = options; this.jspUri = tagFilePath; this.tripCount = 0; unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false; unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false; unloadAllowed = unloadByCount || unloadByIdle ? true : false; ctxt = new JspCompilationContext(jspUri, tagInfo, options, servletContext, this, rctxt, tagJarResource); }
Example #5
Source File: TagLibraryInfoImpl.java From Tomcat8-Source-Read with MIT License | 6 votes |
private TagFileInfo createTagFileInfo(TagFileXml tagFileXml, Jar jar) throws JasperException { String name = tagFileXml.getName(); String path = tagFileXml.getPath(); if (path == null) { // path is required err.jspError("jsp.error.tagfile.missingPath"); } else if (!path.startsWith("/META-INF/tags") && !path.startsWith("/WEB-INF/tags")) { err.jspError("jsp.error.tagfile.illegalPath", path); } TagInfo tagInfo = TagFileProcessor.parseTagFileDirectives(parserController, name, path, jar, this); return new TagFileInfo(name, path, tagInfo); }
Example #6
Source File: JspServletWrapper.java From packagedrone with Eclipse Public License 1.0 | 6 votes |
public JspServletWrapper(ServletContext servletContext, Options options, String tagFilePath, TagInfo tagInfo, JspRuntimeContext rctxt, URL tagFileJarUrl) throws JasperException { this.isTagFile = true; this.config = null; // not used this.options = options; this.jspUri = tagFilePath; this.tripCount = 0; ctxt = new JspCompilationContext(jspUri, tagInfo, options, servletContext, this, rctxt, tagFileJarUrl); }
Example #7
Source File: TagFileProcessor.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Parses the tag file, and collects information on the directives included * in it. The method is used to obtain the info on the tag file, when the * handler that it represents is referenced. The tag file is not compiled * here. * * @param pc * the current ParserController used in this compilation * @param name * the tag name as specified in the TLD * @param path * the path for the tagfile * @param jar * the Jar resource containing the tag file * @param tagLibInfo * the TagLibraryInfo object associated with this TagInfo * @return a TagInfo object assembled from the directives in the tag file. * * @throws JasperException If an error occurs during parsing */ @SuppressWarnings("null") // page can't be null public static TagInfo parseTagFileDirectives(ParserController pc, String name, String path, Jar jar, TagLibraryInfo tagLibInfo) throws JasperException { ErrorDispatcher err = pc.getCompiler().getErrorDispatcher(); Node.Nodes page = null; try { page = pc.parseTagFileDirectives(path, jar); } catch (IOException e) { err.jspError("jsp.error.file.not.found", path); } TagFileDirectiveVisitor tagFileVisitor = new TagFileDirectiveVisitor(pc .getCompiler(), tagLibInfo, name, path); page.visit(tagFileVisitor); tagFileVisitor.postCheck(); return tagFileVisitor.getTagInfo(); }
Example #8
Source File: TagFileProcessor.java From Tomcat8-Source-Read with MIT License | 6 votes |
public TagInfo getTagInfo() throws JasperException { if (name == null) { // XXX Get it from tag file name } if (bodycontent == null) { bodycontent = TagInfo.BODY_CONTENT_SCRIPTLESS; } String tagClassName = JspUtil.getTagHandlerClassName( path, tagLibInfo.getReliableURN(), err); TagVariableInfo[] tagVariableInfos = new TagVariableInfo[variableVector .size()]; variableVector.copyInto(tagVariableInfos); TagAttributeInfo[] tagAttributeInfo = new TagAttributeInfo[attributeVector .size()]; attributeVector.copyInto(tagAttributeInfo); return new JasperTagInfo(name, tagClassName, bodycontent, description, tagLibInfo, null, tagAttributeInfo, displayName, smallIcon, largeIcon, tagVariableInfos, dynamicAttrsMapName); }
Example #9
Source File: TagFileProcessor.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
public TagInfo getTagInfo() throws JasperException { if (name == null) { // XXX Get it from tag file name } if (bodycontent == null) { bodycontent = TagInfo.BODY_CONTENT_SCRIPTLESS; } String tagClassName = JspUtil.getTagHandlerClassName( path, tagLibInfo.getReliableURN(), err); TagVariableInfo[] tagVariableInfos = new TagVariableInfo[variableVector .size()]; variableVector.copyInto(tagVariableInfos); TagAttributeInfo[] tagAttributeInfo = new TagAttributeInfo[attributeVector .size()]; attributeVector.copyInto(tagAttributeInfo); return new JasperTagInfo(name, tagClassName, bodycontent, description, tagLibInfo, tei, tagAttributeInfo, displayName, smallIcon, largeIcon, tagVariableInfos, dynamicAttrsMapName); }
Example #10
Source File: TagLibraryInfo.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Get the TagInfo for a given tag name, looking through all the * tags in this tag library. * * @param shortname The short name (no prefix) of the tag * @return the TagInfo for the tag with the specified short name, or * null if no such tag is found */ public TagInfo getTag(String shortname) { TagInfo tags[] = getTags(); if (tags == null || tags.length == 0) { return null; } for (int i=0; i < tags.length; i++) { if (tags[i].getTagName().equals(shortname)) { return tags[i]; } } return null; }
Example #11
Source File: JspCompilationContext.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
public JspCompilationContext(String tagfile, TagInfo tagInfo, Options options, ServletContext context, JspServletWrapper jsw, JspRuntimeContext rctxt, URL tagFileJarUrl) throws JasperException { this(tagfile, false, options, context, jsw, rctxt); this.isTagFile = true; this.tagInfo = tagInfo; this.tagFileJarUrl = tagFileJarUrl; }
Example #12
Source File: JspDocumentParser.java From Tomcat8-Source-Read with MIT License | 5 votes |
private boolean isTagDependent(Node n) { if (n instanceof Node.CustomTag) { String bodyType = getBodyType((Node.CustomTag) n); return TagInfo.BODY_CONTENT_TAG_DEPENDENT.equalsIgnoreCase(bodyType); } return false; }
Example #13
Source File: Validator.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override public void visit(Node.CustomTag n) throws JasperException { TagInfo tagInfo = n.getTagInfo(); if (tagInfo == null) { err.jspError(n, "jsp.error.missing.tagInfo", n.getQName()); } @SuppressWarnings("null") // tagInfo can't be null here ValidationMessage[] errors = tagInfo.validate(n.getTagData()); if (errors != null && errors.length != 0) { StringBuilder errMsg = new StringBuilder(); errMsg.append("<h3>"); errMsg.append(Localizer.getMessage( "jsp.error.tei.invalid.attributes", n.getQName())); errMsg.append("</h3>"); for (int i = 0; i < errors.length; i++) { errMsg.append("<p>"); if (errors[i].getId() != null) { errMsg.append(errors[i].getId()); errMsg.append(": "); } errMsg.append(errors[i].getMessage()); errMsg.append("</p>"); } err.jspError(n, errMsg.toString()); } visitBody(n); }
Example #14
Source File: Node.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
public CustomTag(String jspVersion, String qName, String prefix, String localName, String uri, Attributes attrs, Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start, Node parent, TagInfo tagInfo, Class tagHandlerClass) { super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs, start, parent); this.jspVersion = Double.valueOf(jspVersion).doubleValue(); this.uri = uri; this.prefix = prefix; this.tagInfo = tagInfo; this.tagHandlerClass = tagHandlerClass; this.customNestingLevel = makeCustomNestingLevel(); this.childInfo = new ChildInfo(); this.implementsIterationTag = IterationTag.class.isAssignableFrom(tagHandlerClass); this.implementsBodyTag = BodyTag.class.isAssignableFrom(tagHandlerClass); this.implementsTryCatchFinally = TryCatchFinally.class.isAssignableFrom(tagHandlerClass); this.implementsSimpleTag = SimpleTag.class.isAssignableFrom(tagHandlerClass); this.implementsDynamicAttributes = DynamicAttributes.class.isAssignableFrom(tagHandlerClass); }
Example #15
Source File: Parser.java From tomcatsrc with Apache License 2.0 | 5 votes |
private void parseSetProperty(Node parent) throws JasperException { Attributes attrs = parseAttributes(); reader.skipSpaces(); Node setPropertyNode = new Node.SetProperty(attrs, start, parent); parseOptionalBody(setPropertyNode, "jsp:setProperty", TagInfo.BODY_CONTENT_EMPTY); }
Example #16
Source File: Generator.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
private void generateTagHandlerPostamble(TagInfo tagInfo) { out.popIndent(); // Have to catch Throwable because a classic tag handler // helper method is declared to throw Throwable. out.printil("} catch( Throwable t ) {"); out.pushIndent(); out.printil("if( t instanceof SkipPageException )"); out.printil(" throw (SkipPageException) t;"); out.printil("if( t instanceof java.io.IOException )"); out.printil(" throw (java.io.IOException) t;"); out.printil("if( t instanceof IllegalStateException )"); out.printil(" throw (IllegalStateException) t;"); out.printil("if( t instanceof JspException )"); out.printil(" throw (JspException) t;"); out.printil("throw new JspException(t);"); out.popIndent(); out.printil("} finally {"); out.pushIndent(); out.printil( "((org.apache.jasper.runtime.JspContextWrapper) jspContext).syncEndTagFile();"); if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) { out.printil("_jspDestroy();"); } out.popIndent(); out.printil("}"); // Close the doTag method out.popIndent(); out.printil("}"); // Generated methods, helper classes, etc. genCommonPostamble(); }
Example #17
Source File: Node.java From Tomcat8-Source-Read with MIT License | 5 votes |
public CustomTag(String qName, String prefix, String localName, String uri, Attributes attrs, Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start, Node parent, TagInfo tagInfo, Class<?> tagHandlerClass) { super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs, start, parent); this.uri = uri; this.prefix = prefix; this.tagInfo = tagInfo; this.tagFileInfo = null; this.tagHandlerClass = tagHandlerClass; this.customNestingLevel = makeCustomNestingLevel(); this.childInfo = new ChildInfo(); this.implementsIterationTag = IterationTag.class .isAssignableFrom(tagHandlerClass); this.implementsBodyTag = BodyTag.class .isAssignableFrom(tagHandlerClass); this.implementsTryCatchFinally = TryCatchFinally.class .isAssignableFrom(tagHandlerClass); this.implementsSimpleTag = SimpleTag.class .isAssignableFrom(tagHandlerClass); this.implementsDynamicAttributes = DynamicAttributes.class .isAssignableFrom(tagHandlerClass); this.implementsJspIdConsumer = JspIdConsumer.class .isAssignableFrom(tagHandlerClass); }
Example #18
Source File: JspCompletionQuery.java From netbeans with Apache License 2.0 | 5 votes |
/** Adds to the list of items <code>compItemList</code> new TagPrefix items with prefix * <code>prefix</code> for list of tag names <code>tagStringItems</code>. * @param set - <code>SyntaxElement.Tag</code> */ private void addTagPrefixItems(CompletionResultSet result, int anchor, JspSyntaxSupport sup, String prefix, List tagStringItems, SyntaxElement.Tag set) { for (int i = 0; i < tagStringItems.size(); i++) { Object item = tagStringItems.get(i); if (item instanceof TagInfo) result.addItem(JspCompletionItem.createPrefixTag(prefix, anchor, (TagInfo)item, set)); else result.addItem(JspCompletionItem.createPrefixTag(prefix + ":" + (String)item, anchor)); // NOI18N } }
Example #19
Source File: JspCompletionQuery.java From netbeans with Apache License 2.0 | 5 votes |
/** Adds to the list of items <code>compItemList</code> new TagPrefix items for prefix list * <code>prefixStringItems</code>, followed by all possible tags for the given prefixes. */ private void addTagPrefixItems(CompletionResultSet result, int anchor, JspSyntaxSupport sup, List<Object> prefixStringItems) { for (int i = 0; i < prefixStringItems.size(); i++) { String prefix = (String)prefixStringItems.get(i); // now get tags for this prefix List tags = sup.getTags(prefix, ""); // NOI18N for (int j = 0; j < tags.size(); j++) { Object item = tags.get(j); if (item instanceof TagInfo) result.addItem(JspCompletionItem.createPrefixTag(prefix, anchor, (TagInfo)item)); else result.addItem(JspCompletionItem.createPrefixTag(prefix + ":" + (String)item, anchor)); // NOI18N } } }
Example #20
Source File: JspCompletionQuery.java From netbeans with Apache License 2.0 | 5 votes |
/** Adds to the list of items <code>compItemList</code> new TagPrefix items with prefix * <code>prefix</code> for list of tag names <code>tagStringItems</code>. */ private void addDirectiveItems(CompletionResultSet result, int anchor, List<TagInfo> directiveStringItems) { for (int i = 0; i < directiveStringItems.size(); i++) { TagInfo item = directiveStringItems.get(i); result.addItem(JspCompletionItem.createDirective( item.getTagName(), anchor, item)); } }
Example #21
Source File: JspCompletionItem.java From netbeans with Apache License 2.0 | 5 votes |
PrefixTag(String prefix, int substitutionOffset, TagInfo ti, SyntaxElement.Tag set) { super(prefix + ":" + (ti != null ? ti.getTagName() : "<null>"), substitutionOffset, ti != null ? ti.getInfoString() : null); // NOI18N tagInfo = ti; if ((tagInfo != null) && (tagInfo.getBodyContent().equalsIgnoreCase(TagInfo.BODY_CONTENT_EMPTY))) { isEmpty = true; } //test whether this tag has some attributes if (set != null) { hasAttributes = !(set.getAttributes().size() == 0); } }
Example #22
Source File: JspCompilationContext.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
public JspCompilationContext(String tagfile, TagInfo tagInfo, Options options, ServletContext context, JspServletWrapper jsw, JspRuntimeContext rctxt, JarResource tagJarResource) { this(tagfile, options, context, jsw, rctxt); this.isTagFile = true; this.tagInfo = tagInfo; this.tagJarResource = tagJarResource; }
Example #23
Source File: Node.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
public CustomTag(String jspVersion, String qName, String prefix, String localName, String uri, Attributes attrs, Mark start, Node parent, TagInfo tagInfo, Class tagHandlerClass) { this(jspVersion, qName, prefix, localName, uri, attrs, null, null, start, parent, tagInfo, tagHandlerClass); }
Example #24
Source File: JspDocumentParser.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
private boolean isTagDependent(Node n) { if (n instanceof Node.CustomTag) { String bodyType = getBodyType((Node.CustomTag) n); return TagInfo.BODY_CONTENT_TAG_DEPENDENT.equalsIgnoreCase(bodyType); } return false; }
Example #25
Source File: Parser.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
private void parseUseBean(Node parent) throws JasperException { Attributes attrs = parseAttributes(); reader.skipSpaces(); Node useBeanNode = new Node.UseBean( attrs, start, parent ); parseOptionalBody( useBeanNode, "jsp:useBean", TagInfo.BODY_CONTENT_JSP ); }
Example #26
Source File: Parser.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
private void parseSetProperty(Node parent) throws JasperException { Attributes attrs = parseAttributes(); reader.skipSpaces(); Node setPropertyNode = new Node.SetProperty(attrs, start, parent); parseOptionalBody(setPropertyNode, "jsp:setProperty", TagInfo.BODY_CONTENT_EMPTY); }
Example #27
Source File: Validator.java From tomcatsrc with Apache License 2.0 | 5 votes |
@Override public void visit(Node.CustomTag n) throws JasperException { TagInfo tagInfo = n.getTagInfo(); if (tagInfo == null) { err.jspError(n, "jsp.error.missing.tagInfo", n.getQName()); } ValidationMessage[] errors = tagInfo.validate(n.getTagData()); if (errors != null && errors.length != 0) { StringBuilder errMsg = new StringBuilder(); errMsg.append("<h3>"); errMsg.append(Localizer.getMessage( "jsp.error.tei.invalid.attributes", n.getQName())); errMsg.append("</h3>"); for (int i = 0; i < errors.length; i++) { errMsg.append("<p>"); if (errors[i].getId() != null) { errMsg.append(errors[i].getId()); errMsg.append(": "); } errMsg.append(errors[i].getMessage()); errMsg.append("</p>"); } err.jspError(n, errMsg.toString()); } visitBody(n); }
Example #28
Source File: TagFileProcessor.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Override public void visit(Node.TagDirective n) throws JasperException { JspUtil.checkAttributes("Tag directive", n, tagDirectiveAttrs, err); bodycontent = checkConflict(n, bodycontent, "body-content"); if (bodycontent != null && !bodycontent .equalsIgnoreCase(TagInfo.BODY_CONTENT_EMPTY) && !bodycontent .equalsIgnoreCase(TagInfo.BODY_CONTENT_TAG_DEPENDENT) && !bodycontent .equalsIgnoreCase(TagInfo.BODY_CONTENT_SCRIPTLESS)) { err.jspError(n, "jsp.error.tagdirective.badbodycontent", bodycontent); } dynamicAttrsMapName = checkConflict(n, dynamicAttrsMapName, "dynamic-attributes"); if (dynamicAttrsMapName != null) { checkUniqueName(dynamicAttrsMapName, TAG_DYNAMIC, n); } smallIcon = checkConflict(n, smallIcon, "small-icon"); largeIcon = checkConflict(n, largeIcon, "large-icon"); description = checkConflict(n, description, "description"); displayName = checkConflict(n, displayName, "display-name"); example = checkConflict(n, example, "example"); }
Example #29
Source File: Parser.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
private void parseSetProperty(Node parent) throws JasperException { Attributes attrs = parseAttributes(); reader.skipSpaces(); Node setPropertyNode = new Node.SetProperty( attrs, start, parent ); parseOptionalBody(setPropertyNode, "jsp:setProperty", TagInfo.BODY_CONTENT_EMPTY); }
Example #30
Source File: Parser.java From tomcatsrc with Apache License 2.0 | 5 votes |
private void parseElement(Node parent) throws JasperException { Attributes attrs = parseAttributes(); reader.skipSpaces(); Node elementNode = new Node.JspElement(attrs, start, parent); parseOptionalBody(elementNode, "jsp:element", TagInfo.BODY_CONTENT_JSP); }