cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler PageDataImpl.java Validator.java

2004-05-11 Thread kinman
kinman  2004/05/11 18:14:59

  Modified:jasper2/src/share/org/apache/jasper/compiler
PageDataImpl.java Validator.java
  Log:
  - Fix 28696: xsi:schemaLocation should be a valid attribute for jsp:root.
  
  Revision  ChangesPath
  1.38  +1 -0  
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java
  
  Index: PageDataImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- PageDataImpl.java 17 Mar 2004 19:23:03 -  1.37
  +++ PageDataImpl.java 12 May 2004 01:14:59 -  1.38
  @@ -160,6 +160,7 @@
   
public void visit(Node.JspRoot n) throws JasperException {
addAttributes(n.getTaglibAttributes());
  +addAttributes(n.getNonTaglibXmlnsAttributes());
addAttributes(n.getAttributes());
   
visitBody(n);
  
  
  
  1.117 +1 -0  
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.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- Validator.java17 Mar 2004 19:23:03 -  1.116
  +++ Validator.java12 May 2004 01:14:59 -  1.117
  @@ -300,6 +300,7 @@
   private ClassLoader loader;
   
private static final JspUtil.ValidAttribute[] jspRootAttrs = {
  +new JspUtil.ValidAttribute(xsi:schemaLocation),
new JspUtil.ValidAttribute(version, true) };
   
private static final JspUtil.ValidAttribute[] includeDirectiveAttrs = {
  
  
  

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



cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler PageDataImpl.java Validator.java

2002-11-07 Thread luehe
luehe   2002/11/07 10:34:19

  Modified:jasper2/src/share/org/apache/jasper/compiler
PageDataImpl.java Validator.java
  Log:
  Append tag directive (containing single 'pageEncoding' attribute whose
  value is hard-coded to UTF-8) to XML view of tag files, and suppress
  'pageEncoding' attribute in any existing tag directives.
  
  Revision  ChangesPath
  1.17  +98 -29
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java
  
  Index: PageDataImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- PageDataImpl.java 6 Nov 2002 20:58:10 -   1.16
  +++ PageDataImpl.java 7 Nov 2002 18:34:19 -   1.17
   -120,7 +120,7 
*
* param page the page nodes from which to generate the XML view
*/
  -public PageDataImpl(Node.Nodes page, PageInfo pageInfo)
  +public PageDataImpl(Node.Nodes page, Compiler compiler)
throws JasperException {
   
// First pass
   -131,7 +131,7 
// Second pass
buf = new StringBuffer();
SecondPassVisitor secondPassVisitor
  - = new SecondPassVisitor(page.getRoot(), buf, pageInfo);
  + = new SecondPassVisitor(page.getRoot(), buf, compiler);
page.visit(secondPassVisitor);
   }
   
   -237,7 +237,7 
   
private Node.Root root;
private StringBuffer buf;
  - private PageInfo pageInfo;
  + private Compiler compiler;
   
// current jsp:id attribute value
private int jspId;
   -246,10 +246,10 
 * Constructor
 */
public SecondPassVisitor(Node.Root root, StringBuffer buf,
  -  PageInfo pageInfo) {
  +  Compiler compiler) {
this.root = root;
this.buf = buf;
  - this.pageInfo = pageInfo;
  + this.compiler = compiler;
}
   
/*
   -371,7 +371,7 
}
   
public void visit(Node.TagDirective n) throws JasperException {
  - appendTag(JSP_TAG_DIRECTIVE, n.getAttributes(), null, null);
  + appendTagDirective(n);
}
   
public void visit(Node.AttributeDirective n) throws JasperException {
   -408,7 +408,11 
if (tag.equals(JSP_ROOT) || body != null || text != null) {
buf.append(\n);
if (tag.equals(JSP_ROOT)) {
  - appendPageDirective();
  + if (compiler.getCompilationContext().isTagFile()) {
  + appendTagDirective();
  + } else {
  + appendPageDirective();
  + }
}
if (body != null) {
body.visit(this);
   -430,9 +434,27 
 * document, and since XML allows only single-value attributes,
 * the values of multiple import attributes must be combined into one,
 * separated by comma.
  +  *
  +  * If the given page directive contains just 'contentType' and/or
  +  * 'pageEncoding' attributes, we ignore it, as we've already appended
  +  * a page directive containing just these two attributes.
 */
private void appendPageDirective(Node.PageDirective pageDir) {
  + boolean append = false;
Attributes attrs = pageDir.getAttributes();
  + int len = attrs.getLength();
  + for (int i=0; ilen; i++) {
  + String attrName = attrs.getQName(i);
  + if (!pageEncoding.equals(attrName)
  +  !contentType.equals(attrName)) {
  + append = true;
  + break;
  + }
  + }
  + if (!append) {
  + return;
  + }
  +
buf.append().append(JSP_PAGE_DIRECTIVE);
buf.append(\n);
   
   -441,7 +463,6 
buf.append(jspId++).append(\\n);
   
// append remaining attributes
  - int len = attrs.getLength();
for (int i=0; ilen; i++) {
String attrName = attrs.getQName(i);
if (import.equals(attrName) || contentType.equals(attrName)
   -449,7 +470,7 
/*
 * Page directive's 'import' attribute is considered
 * further down, and its 'pageEncoding' and 'contentType'
  -  * attributes are ignored, since we've already created 
  +  * attributes are ignored, since we've already appended
 * a new page directive containing just these two
 * attributes
 */
   -477,6 +498,71 
buf.append(/\n);
}
   
  + /*
  +  * Appends a page directive with 'pageEncoding' and 'contentType'