You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ru...@us.ibm.com on 2000/01/21 15:04:32 UTC

Why was Jasper support for XML Scripting elements removed?


Support for the items in section 7.4 of the spec appear to have been
removed.  I don't recall any discussion of this - nor did I appear to get
any CVS notification.  As far as I can tell, the support was present and
working in the code, and remains in the spec - it simply was removed.

Why?

----

date: 2000/01/14 04:34:38;  author: shemnon;  state: Exp;  lines: +8 -15
Brings the XML handling in accordance with the spec, as clarified by
edward/o.  Also the xml.jsp test has been transformed as per the spec
(I think, up for review) and it has been removed from the tests since it
likely will not be working in a main line branch w/in three months.

Index: Parser.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Parser.java     1999/12/29 21:27:30  1.11
+++ Parser.java     2000/01/14 04:34:38  1.12
@@ -113,8 +113,6 @@
     static final class Directive implements CoreElement {
     private static final String OPEN_DIRECTIVE  = "<%@";
     private static final String CLOSE_DIRECTIVE = "%>";
-        private static final String OPEN_DIRECTIVE_2 = "<jsp:directive.";
-    private static final String CLOSE_DIRECTIVE_2 = "/>";

     static final String[] directives = {
       "page",
@@ -154,9 +152,6 @@
         if (reader.matches(OPEN_DIRECTIVE)) {
          open = OPEN_DIRECTIVE;
          close = CLOSE_DIRECTIVE;
-        } else if (reader.matches(OPEN_DIRECTIVE_2)) {
-         open = OPEN_DIRECTIVE_2;-           close = CLOSE_DIRECTIVE_2;
         } else
          return false;

@@ -419,10 +414,6 @@
     private static final String OPEN_DECL  = "<%!";
     private static final String CLOSE_DECL = "%>";

-    private static final String OPEN_DECL_2   = "<jsp:decl";
-    private static final String END_OPEN_DECL_2 = ">";
-    private static final String CLOSE_DECL_2 = "</jsp:decl>";
-
         private static final JspUtil.ValidAttribute[] validAttributes = {
         };

@@ -432,11 +423,7 @@
         String close, open, end_open = null;
             Hashtable attrs = null;

-        if (reader.matches(OPEN_DECL_2)) {
-         open = OPEN_DECL_2;
-                end_open = END_OPEN_DECL_2;
-         close = CLOSE_DECL_2;
-        } else if (reader.matches(OPEN_DECL)) {
+        if (reader.matches(OPEN_DECL)) {
          open = OPEN_DECL;
          close = CLOSE_DECL;
         } else
@@ -479,10 +466,6 @@
     private static final String OPEN_EXPR  = "<%=";
     private static final String CLOSE_EXPR = "%>";

-    private static final String OPEN_EXPR_2   = "<jsp:expression";
-    private static final String END_OPEN_EXPR_2 = ">";
-    private static final String CLOSE_EXPR_2 = "</jsp:expression>";
-
         private static final JspUtil.ValidAttribute[] validAttributes = {
         };

@@ -492,11 +475,7 @@
         String close, open, end_open=null;
             Hashtable attrs = null;

-        if (reader.matches(OPEN_EXPR_2)) {
-         open = OPEN_EXPR_2;
-                end_open = END_OPEN_EXPR_2;
-         close = CLOSE_EXPR_2;
-        } else if (reader.matches(OPEN_EXPR)) {
+        if (reader.matches(OPEN_EXPR)) {
          open = OPEN_EXPR;
          close = CLOSE_EXPR;
         } else
@@ -538,10 +517,6 @@
     private static final String OPEN_SCRIPTLET  = "<%";
     private static final String CLOSE_SCRIPTLET = "%>";

-    private static final String OPEN_SCRIPTLET_2  = "<jsp:scriptlet";
-    private static final String END_OPEN_SCRIPTLET_2 = ">";
-    private static final String CLOSE_SCRIPTLET_2 = "</jsp:scriptlet>";
-
         private static final JspUtil.ValidAttribute[] validAttributes = {
         };

@@ -551,11 +526,7 @@
         String close, open, end_open = null;
             Hashtable attrs = null;

-        if (reader.matches(OPEN_SCRIPTLET_2)) {
-         open = OPEN_SCRIPTLET_2;
-                end_open = END_OPEN_SCRIPTLET_2;
-         close = CLOSE_SCRIPTLET_2;
-        } else if (reader.matches(OPEN_SCRIPTLET)) {
+        if (reader.matches(OPEN_SCRIPTLET)) {
          open = OPEN_SCRIPTLET;
          close = CLOSE_SCRIPTLET;
         } else

Index: JspUtil.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v

retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JspUtil.java    1999/12/24 12:57:17  1.7
+++ JspUtil.java    2000/01/14 04:34:38  1.8
@@ -1,7 +1,7 @@
 /*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v

1.7 1999/12/24 12:57:17 rubys Exp $
- * $Revision: 1.7 $
- * $Date: 1999/12/24 12:57:17 $
+ * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v

1.8 2000/01/14 04:34:38 shemnon Exp $
+ * $Revision: 1.8 $
+ * $Date: 2000/01/14 04:34:38 $
  *
  * ====================================================================
  *
@@ -88,8 +88,6 @@

     private static final String OPEN_EXPR  = "<%=";
     private static final String CLOSE_EXPR = "%>";
-    private static final String OPEN_EXPR_2 = "%=";
-    private static final String CLOSE_EXPR_2 = "%";

     public static char[] removeQuotes(char []chars) {
     CharArrayWriter caw = new CharArrayWriter();
@@ -108,11 +106,9 @@
     // Checks if the token is a runtime expression.
     public static boolean isExpression (String token) {

-    if (token.startsWith(OPEN_EXPR) && token.endsWith(CLOSE_EXPR))
+    if (token.startsWith(OPEN_EXPR) && token.endsWith(CLOSE_EXPR)) {
         return true;
-
-    if (token.startsWith(OPEN_EXPR_2) && token.endsWith(CLOSE_EXPR_2))
-        return true;
+    }

     return false;
     }
@@ -122,14 +118,11 @@
     String returnString;
     int length = expression.length();

-    if (expression.startsWith(OPEN_EXPR) &&
expression.endsWith(CLOSE_EXPR))
+    if (expression.startsWith(OPEN_EXPR) &&
expression.endsWith(CLOSE_EXPR)) {
         returnString = expression.substring (OPEN_EXPR.length(), length -
CLOSE_EXPR.length());
-
-    else if (expression.startsWith(OPEN_EXPR_2) &&
expression.endsWith(CLOSE_EXPR_2))
-        returnString = expression.substring (OPEN_EXPR_2.length(), length
- CLOSE_EXPR_2.length());
-
-    else
+    } else {
         returnString = "";
+    }

     return returnString;
     }



Re: Why was Jasper support for XML Scripting elements removed?

Posted by Eduardo Pelegri-Llopart <Ed...@eng.sun.com>.
I do not remember exactly what I said, but it probably was close to
this:

* The spec says that it is not legal to mix the xml elements and the
non-xml elements - at least it says so clearly for the case of the same
file.  I am not sure what it says about doing an <%@ page include ...%>
across styles; I would not be surprised if this is unspecified.

* The spec does not talk about using xml elements in request-time
attributes (I remember something about that, although it could be a
different message).

* The spec does not say anything about what a container can do with the
"XML document equivalent to a JSP page".

* The spec also says, somewhere - or at least implies, that we are
likely to change the details of the xml elements in the next version of
the spec, since we are still figuring out what "the right thing to do"
is.

So fixing the intermixing within the same file, and correcting some of
the other bugs was, I think, non-controversial.

The trickier part is whether to allow an XML doc as an input at all. 
With the view of Tomcat as the "RI" it makes more sense not to accept
it, since having it is likely to encourage its use which complicates
live for its evolution.  A view of Tomcat as source base for some
specific implementation may point otherwise.

Here, I found the message and I am attaching it.  I don't have the
complete thread with +s and the such.  I don't think there was any
dissenters at the time.

I would be willing to go with a configuration mode that turns the XML
syntax off.  My key goal is to make it clear to the user that the XML
syntax is not something really final - we really need that at the spec
level.

Hope this helps,

	- eduard/o


rubys@us.ibm.com wrote:
> 
> Support for the items in section 7.4 of the spec appear to have been
> removed.  I don't recall any discussion of this - nor did I appear to get
> any CVS notification.  As far as I can tell, the support was present and
> working in the code, and remains in the spec - it simply was removed.
> 
> Why?
>

Re: Why was Jasper support for XML Scripting elements removed?

Posted by Eduardo Pelegri-Llopart <Ed...@eng.sun.com>.
there are several that could fit that description and I have not tried
them yet.  Which one?

	- eduard/o

Wong Kok Wai wrote:
> 
> As an interesting note: a well-known application server that just releases the
> beta of its latest version supports them in the JSP engine.

Re: Why was Jasper support for XML Scripting elements removed?

Posted by Wong Kok Wai <wo...@pacific.net.sg>.
As an interesting note: a well-known application server that just releases the
beta of its latest version supports them in the JSP engine.

Anil K. Vijendran wrote:

> See Eduardo's mail on this topic (subject: use of xml syntax) on
> tomcat-dev. The idea is mixing both non xml and xml equivalents was not
> intended by the spec and that's exactly what the parser was doing --
> allowing things to be intermixed.
>


Re: Why was Jasper support for XML Scripting elements removed?

Posted by "Anil K. Vijendran" <An...@eng.sun.com>.
See Eduardo's mail on this topic (subject: use of xml syntax) on
tomcat-dev. The idea is mixing both non xml and xml equivalents was not
intended by the spec and that's exactly what the parser was doing --
allowing things to be intermixed. 

Hans, Eduardo, Danno +1ed it explicitly. Mine was a +1 too I think, can't
remember. 

On Fri, 21 Jan 2000 rubys@us.ibm.com wrote:

> 
> 
> Support for the items in section 7.4 of the spec appear to have been
> removed.  I don't recall any discussion of this - nor did I appear to get
> any CVS notification.  As far as I can tell, the support was present and
> working in the code, and remains in the spec - it simply was removed.
> 
> Why?
> 
> ----
> 
> date: 2000/01/14 04:34:38;  author: shemnon;  state: Exp;  lines: +8 -15
> Brings the XML handling in accordance with the spec, as clarified by
> edward/o.  Also the xml.jsp test has been transformed as per the spec
> (I think, up for review) and it has been removed from the tests since it
> likely will not be working in a main line branch w/in three months.
> 
> Index: Parser.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java,v
> retrieving revision 1.11
> retrieving revision 1.12
> diff -u -r1.11 -r1.12
> --- Parser.java     1999/12/29 21:27:30  1.11
> +++ Parser.java     2000/01/14 04:34:38  1.12
> @@ -113,8 +113,6 @@
>      static final class Directive implements CoreElement {
>      private static final String OPEN_DIRECTIVE  = "<%@";
>      private static final String CLOSE_DIRECTIVE = "%>";
> -        private static final String OPEN_DIRECTIVE_2 = "<jsp:directive.";
> -    private static final String CLOSE_DIRECTIVE_2 = "/>";
> 
>      static final String[] directives = {
>        "page",
> @@ -154,9 +152,6 @@
>          if (reader.matches(OPEN_DIRECTIVE)) {
>           open = OPEN_DIRECTIVE;
>           close = CLOSE_DIRECTIVE;
> -        } else if (reader.matches(OPEN_DIRECTIVE_2)) {
> -         open = OPEN_DIRECTIVE_2;-           close = CLOSE_DIRECTIVE_2;
>          } else
>           return false;
> 
> @@ -419,10 +414,6 @@
>      private static final String OPEN_DECL  = "<%!";
>      private static final String CLOSE_DECL = "%>";
> 
> -    private static final String OPEN_DECL_2   = "<jsp:decl";
> -    private static final String END_OPEN_DECL_2 = ">";
> -    private static final String CLOSE_DECL_2 = "</jsp:decl>";
> -
>          private static final JspUtil.ValidAttribute[] validAttributes = {
>          };
> 
> @@ -432,11 +423,7 @@
>          String close, open, end_open = null;
>              Hashtable attrs = null;
> 
> -        if (reader.matches(OPEN_DECL_2)) {
> -         open = OPEN_DECL_2;
> -                end_open = END_OPEN_DECL_2;
> -         close = CLOSE_DECL_2;
> -        } else if (reader.matches(OPEN_DECL)) {
> +        if (reader.matches(OPEN_DECL)) {
>           open = OPEN_DECL;
>           close = CLOSE_DECL;
>          } else
> @@ -479,10 +466,6 @@
>      private static final String OPEN_EXPR  = "<%=";
>      private static final String CLOSE_EXPR = "%>";
> 
> -    private static final String OPEN_EXPR_2   = "<jsp:expression";
> -    private static final String END_OPEN_EXPR_2 = ">";
> -    private static final String CLOSE_EXPR_2 = "</jsp:expression>";
> -
>          private static final JspUtil.ValidAttribute[] validAttributes = {
>          };
> 
> @@ -492,11 +475,7 @@
>          String close, open, end_open=null;
>              Hashtable attrs = null;
> 
> -        if (reader.matches(OPEN_EXPR_2)) {
> -         open = OPEN_EXPR_2;
> -                end_open = END_OPEN_EXPR_2;
> -         close = CLOSE_EXPR_2;
> -        } else if (reader.matches(OPEN_EXPR)) {
> +        if (reader.matches(OPEN_EXPR)) {
>           open = OPEN_EXPR;
>           close = CLOSE_EXPR;
>          } else
> @@ -538,10 +517,6 @@
>      private static final String OPEN_SCRIPTLET  = "<%";
>      private static final String CLOSE_SCRIPTLET = "%>";
> 
> -    private static final String OPEN_SCRIPTLET_2  = "<jsp:scriptlet";
> -    private static final String END_OPEN_SCRIPTLET_2 = ">";
> -    private static final String CLOSE_SCRIPTLET_2 = "</jsp:scriptlet>";
> -
>          private static final JspUtil.ValidAttribute[] validAttributes = {
>          };
> 
> @@ -551,11 +526,7 @@
>          String close, open, end_open = null;
>              Hashtable attrs = null;
> 
> -        if (reader.matches(OPEN_SCRIPTLET_2)) {
> -         open = OPEN_SCRIPTLET_2;
> -                end_open = END_OPEN_SCRIPTLET_2;
> -         close = CLOSE_SCRIPTLET_2;
> -        } else if (reader.matches(OPEN_SCRIPTLET)) {
> +        if (reader.matches(OPEN_SCRIPTLET)) {
>           open = OPEN_SCRIPTLET;
>           close = CLOSE_SCRIPTLET;
>          } else
> 
> Index: JspUtil.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v
> 
> retrieving revision 1.7
> retrieving revision 1.8
> diff -u -r1.7 -r1.8
> --- JspUtil.java    1999/12/24 12:57:17  1.7
> +++ JspUtil.java    2000/01/14 04:34:38  1.8
> @@ -1,7 +1,7 @@
>  /*
> - * $Header:
> /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v
> 
> 1.7 1999/12/24 12:57:17 rubys Exp $
> - * $Revision: 1.7 $
> - * $Date: 1999/12/24 12:57:17 $
> + * $Header:
> /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v
> 
> 1.8 2000/01/14 04:34:38 shemnon Exp $
> + * $Revision: 1.8 $
> + * $Date: 2000/01/14 04:34:38 $
>   *
>   * ====================================================================
>   *
> @@ -88,8 +88,6 @@
> 
>      private static final String OPEN_EXPR  = "<%=";
>      private static final String CLOSE_EXPR = "%>";
> -    private static final String OPEN_EXPR_2 = "%=";
> -    private static final String CLOSE_EXPR_2 = "%";
> 
>      public static char[] removeQuotes(char []chars) {
>      CharArrayWriter caw = new CharArrayWriter();
> @@ -108,11 +106,9 @@
>      // Checks if the token is a runtime expression.
>      public static boolean isExpression (String token) {
> 
> -    if (token.startsWith(OPEN_EXPR) && token.endsWith(CLOSE_EXPR))
> +    if (token.startsWith(OPEN_EXPR) && token.endsWith(CLOSE_EXPR)) {
>          return true;
> -
> -    if (token.startsWith(OPEN_EXPR_2) && token.endsWith(CLOSE_EXPR_2))
> -        return true;
> +    }
> 
>      return false;
>      }
> @@ -122,14 +118,11 @@
>      String returnString;
>      int length = expression.length();
> 
> -    if (expression.startsWith(OPEN_EXPR) &&
> expression.endsWith(CLOSE_EXPR))
> +    if (expression.startsWith(OPEN_EXPR) &&
> expression.endsWith(CLOSE_EXPR)) {
>          returnString = expression.substring (OPEN_EXPR.length(), length -
> CLOSE_EXPR.length());
> -
> -    else if (expression.startsWith(OPEN_EXPR_2) &&
> expression.endsWith(CLOSE_EXPR_2))
> -        returnString = expression.substring (OPEN_EXPR_2.length(), length
> - CLOSE_EXPR_2.length());
> -
> -    else
> +    } else {
>          returnString = "";
> +    }
> 
>      return returnString;
>      }
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 

--
Peace, Anil +<:-)