luehe       2002/07/31 16:45:50

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        ImplicitTagLibraryInfo.java TagFileProcessor.java
  Log:
  Modified implicit taglibrary generator to populate new "tagFiles"
  field in TagLibraryInfo
  
  Revision  Changes    Path
  1.5       +22 -14    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
  
  Index: ImplicitTagLibraryInfo.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ImplicitTagLibraryInfo.java       31 Jul 2002 22:46:27 -0000      1.4
  +++ ImplicitTagLibraryInfo.java       31 Jul 2002 23:45:50 -0000      1.5
  @@ -63,6 +63,7 @@
   import java.util.*;
   import javax.servlet.jsp.tagext.TagLibraryInfo;
   import javax.servlet.jsp.tagext.TagInfo;
  +import javax.servlet.jsp.tagext.TagFileInfo;
   import org.apache.jasper.JspCompilationContext;
   import org.apache.jasper.JasperException;
   
  @@ -101,7 +102,8 @@
            err.jspError("jsp.error.invalid.tagdir", tagdir);
        }
        
  -     // Determine the value of the <short-name> element
  +     // Determine the value of the <short-name> subelement of the
  +     // "imaginary" <taglib> element
        if (tagdir.equals(WEB_INF_TAGS)) {
            shortname = TAGS_SHORTNAME;
        } else {
  @@ -111,24 +113,30 @@
   
        Set dirList = ctxt.getResourcePaths(tagdir);
        if (dirList != null) {
  -         Vector tagVector = new Vector();
  +         Vector vec = new Vector();
            Iterator it = dirList.iterator();
            while (it.hasNext()) {
                String path = (String) it.next();
  -             if (path.endsWith(".tld")) {
  +             if (path.endsWith(TLD_SUFFIX)) {
                    tldFile = path;
                    break;
  -             } else if (path.endsWith(".tag")) {
  -                 tagVector.addElement(
  -                                    TagFileProcessor.parseTagFile(pc,
  -                                                               shortname,
  -                                                               path,
  -                                                               this)); 
  +             } else if (path.endsWith(TAG_FILE_SUFFIX)) {
  +                 // use the filename of the tag file, without the .tag
  +                 // extension, as the <name> subelement of the "imaginary"
  +                 // <tag-file> element
  +                 String tagName = path.substring(path.lastIndexOf("/") + 1);
  +                 tagName = tagName.substring(0,
  +                                             tagName.lastIndexOf(TAG_FILE_SUFFIX));
  +                 TagInfo tagInfo = TagFileProcessor.parseTagFile(pc,
  +                                                                 tagName,
  +                                                                 path,
  +                                                                 this); 
  +                 vec.addElement(new TagFileInfo(tagName, path, tagInfo));
                }
            }
   
  -         tags = new TagInfo[tagVector.size()];
  -         tagVector.copyInto (this.tags);
  +         this.tagFiles = new TagFileInfo[vec.size()];
  +         vec.copyInto(this.tagFiles);
        }
       }
   
  
  
  
  1.6       +6 -6      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java
  
  Index: TagFileProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TagFileProcessor.java     31 Jul 2002 21:42:27 -0000      1.5
  +++ TagFileProcessor.java     31 Jul 2002 23:45:50 -0000      1.6
  @@ -311,8 +311,9 @@
        * handler that it represents is referenced.  The tag file is not compiled
        * here.
        * @param pc the current ParserController used in this compilation
  -     * @param tagile the path for the tagfile
  -     * @param tagLibInfo the TaglibraryInfo object associated with this TagInfo
  +     * @param name the tag name as specified in the TLD
  +     * @param tagfile the path for the tagfile
  +     * @param tagLibInfo the TagLibraryInfo object associated with this TagInfo
        * @return a TagInfo object assembled from the directives in the tag file.
        */
       public static TagInfo parseTagFile(ParserController pc,
  @@ -321,7 +322,6 @@
                                       TagLibraryInfo tagLibInfo)
                   throws JasperException {
   
  -
           Node.Nodes page = null;
        try {
            page = pc.parse(tagfile);
  @@ -342,7 +342,7 @@
        * Compiles and loads a tagfile.
        */
       public static Class loadTagFile(JspCompilationContext ctxt,
  -                                       String tagFile, TagInfo tagInfo)
  +                                 String tagFile, TagInfo tagInfo)
        throws JasperException {
   
        JspRuntimeContext rctxt = ctxt.getRuntimeContext();
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to