kinman      02/05/23 14:29:38

  Modified:    jasper2/src/share/org/apache/jasper/compiler Node.java
                        Validator.java
  Log:
  - Set the default content type only after all page directives are processed.
    Also, the top level page sets the default, i.e. if a non-xml page includes
    a xml page, the default content type is "text/html" and not "text/xml".
  
  Revision  Changes    Path
  1.9       +5 -4      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java
  
  Index: Node.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Node.java 15 May 2002 20:42:03 -0000      1.8
  +++ Node.java 23 May 2002 21:29:38 -0000      1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v
 1.8 2002/05/15 20:42:03 kinman Exp $
  - * $Revision: 1.8 $
  - * $Date: 2002/05/15 20:42:03 $
  + * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v
 1.9 2002/05/23 21:29:38 kinman Exp $
  + * $Revision: 1.9 $
  + * $Date: 2002/05/23 21:29:38 $
    *
    * ====================================================================
    * 
  @@ -793,7 +793,7 @@
       public static class Nodes {
   
        private List list;
  -     private Node.Root root;
  +     private Node.Root root;         // null if this is not a page
   
        public Nodes() {
            list = new Vector();
  @@ -811,6 +811,7 @@
         */
        public void add(Node n) {
            list.add(n);
  +         root = null;
        }
   
        /**
  
  
  
  1.8       +15 -13    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java
  
  Index: Validator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Validator.java    18 May 2002 00:29:24 -0000      1.7
  +++ Validator.java    23 May 2002 21:29:38 -0000      1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v
 1.7 2002/05/18 00:29:24 kinman Exp $
  - * $Revision: 1.7 $
  - * $Date: 2002/05/18 00:29:24 $
  + * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v
 1.8 2002/05/23 21:29:38 kinman Exp $
  + * $Revision: 1.8 $
  + * $Date: 2002/05/23 21:29:38 $
    *
    * ====================================================================
    * 
  @@ -244,16 +244,6 @@
            // Attributes for imports for this node have been processed by
            // the parsers, just add them to pageInfo.
            pageInfo.addImports(n.getImports());
  -
  -         // Determine the output context type, per errata_a
  -         // 
http://jcp.org/aboutJava/communityprocess/maintenance/jsr053/errata_1_2_a_20020321.html
  -         if (pageInfo.getContentType() == null) {
  -             String defaultType = n.isXmlSyntax()? "text/xml;": "text/html;";
  -             String charset = pageInfo.getPageEncoding();
  -             if (charset == null)
  -                 charset = n.isXmlSyntax()? "UTF-8": "ISO-8859-1";
  -             pageInfo.setContentType(defaultType + charset);
  -         }
        }
       }
   
  @@ -613,6 +603,18 @@
         * and are position independent.
         */
        page.visit(new PageDirectiveVisitor(compiler));
  +
  +     // Determine the default output content type, per errata_a
  +     // 
http://jcp.org/aboutJava/communityprocess/maintenance/jsr053/errata_1_2_a_20020321.html
  +     PageInfo pageInfo = compiler.getPageInfo();
  +     if (pageInfo.getContentType() == null) {
  +         boolean isXml = page.getRoot().isXmlSyntax();
  +         String defaultType = isXml? "text/xml;": "text/html;";
  +         String charset = pageInfo.getPageEncoding();
  +         if (charset == null)
  +             charset = isXml? "UTF-8": "ISO-8859-1";
  +         pageInfo.setContentType(defaultType + charset);
  +     }
   
        /*
         * Validate all other nodes.
  
  
  

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

Reply via email to