You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/04/21 11:06:13 UTC
[tomcat] branch main updated: Align with latest plans for JSP 3.1 - make jsp:plugin a NO-OP
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 78e4123fea Align with latest plans for JSP 3.1 - make jsp:plugin a NO-OP
78e4123fea is described below
commit 78e4123fea658e1a40607ae543e86d051d2a4e3e
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Apr 21 12:06:01 2022 +0100
Align with latest plans for JSP 3.1 - make jsp:plugin a NO-OP
No major browser supports the HTML generated for jsp:pluin
---
conf/web.xml | 5 -
java/org/apache/jasper/Constants.java | 13 --
java/org/apache/jasper/EmbeddedServletOptions.java | 23 --
java/org/apache/jasper/JspC.java | 21 --
java/org/apache/jasper/Options.java | 10 -
java/org/apache/jasper/compiler/Generator.java | 243 +--------------------
webapps/docs/changelog.xml | 11 +
webapps/docs/jasper-howto.xml | 5 -
8 files changed, 12 insertions(+), 319 deletions(-)
diff --git a/conf/web.xml b/conf/web.xml
index 53d6802563..f009e9f293 100644
--- a/conf/web.xml
+++ b/conf/web.xml
@@ -195,11 +195,6 @@
<!-- arrays, to improve performance in some cases? -->
<!-- [false] -->
<!-- -->
- <!-- ieClassId Deprecated. Will be removed in Tomcat 10.1 -->
- <!-- The class-id value to be sent to Internet -->
- <!-- Explorer when using <jsp:plugin> tags. -->
- <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
- <!-- -->
<!-- javaEncoding Java file encoding to use for generating java -->
<!-- source files. [UTF8] -->
<!-- -->
diff --git a/java/org/apache/jasper/Constants.java b/java/org/apache/jasper/Constants.java
index 0f5a5038a1..ec17ceadb3 100644
--- a/java/org/apache/jasper/Constants.java
+++ b/java/org/apache/jasper/Constants.java
@@ -59,19 +59,6 @@ public class Constants {
*/
public static final int MAX_POOL_SIZE = 5;
- /**
- * Default URLs to download the plugin for Netscape and IE.
- *
- * @deprecated Will be removed in Tomcat 10.1 onwards
- */
- @Deprecated
- public static final String NS_PLUGIN_URL =
- "http://java.sun.com/products/plugin/";
-
- @Deprecated
- public static final String IE_PLUGIN_URL =
- "http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0";
-
/**
* Has security been turned on?
*/
diff --git a/java/org/apache/jasper/EmbeddedServletOptions.java b/java/org/apache/jasper/EmbeddedServletOptions.java
index 17d7d45dfa..a0a88dea46 100644
--- a/java/org/apache/jasper/EmbeddedServletOptions.java
+++ b/java/org/apache/jasper/EmbeddedServletOptions.java
@@ -111,13 +111,6 @@ public final class EmbeddedServletOptions implements Options {
*/
private File scratchDir;
- /**
- * Need to have this as is for versions 4 and 5 of IE. Can be set from
- * the initParams so if it changes in the future all that is needed is
- * to have a jsp initParam of type ieClassId="<value>"
- */
- private String ieClassId = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
-
/**
* What classpath should I use while compiling generated servlets?
*/
@@ -345,17 +338,6 @@ public final class EmbeddedServletOptions implements Options {
return this.genStringAsCharArray;
}
- /**
- * Class ID for use in the plugin tag when the browser is IE.
- *
- * @deprecated Will be removed in Tomcat 10.1
- */
- @Deprecated
- @Override
- public String getIeClassId() {
- return ieClassId;
- }
-
/**
* What is my scratch dir?
*/
@@ -736,11 +718,6 @@ public final class EmbeddedServletOptions implements Options {
}
}
- String ieClassId = config.getInitParameter("ieClassId");
- if (ieClassId != null) {
- this.ieClassId = ieClassId;
- }
-
String classpath = config.getInitParameter("classpath");
if (classpath != null) {
this.classpath = classpath;
diff --git a/java/org/apache/jasper/JspC.java b/java/org/apache/jasper/JspC.java
index 773b70fc10..88b4687376 100644
--- a/java/org/apache/jasper/JspC.java
+++ b/java/org/apache/jasper/JspC.java
@@ -187,7 +187,6 @@ public class JspC extends Task implements Options {
protected boolean poolingEnabled = true;
protected File scratchDir;
- protected String ieClassId = DEFAULT_IE_CLASS_ID;
protected String targetPackage;
protected String targetClassName;
protected String uriBase;
@@ -703,26 +702,6 @@ public class JspC extends Task implements Options {
return genStringAsCharArray;
}
- /**
- * Sets the class-id value to be sent to Internet Explorer when using
- * <jsp:plugin> tags.
- *
- * @param ieClassId
- * Class-id value
- *
- * @deprecated Will be removed in Tomcat 10.1
- */
- @Deprecated
- public void setIeClassId(String ieClassId) {
- this.ieClassId = ieClassId;
- }
-
- @Deprecated
- @Override
- public String getIeClassId() {
- return ieClassId;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/java/org/apache/jasper/Options.java b/java/org/apache/jasper/Options.java
index 04fe5c1592..d47c7089e1 100644
--- a/java/org/apache/jasper/Options.java
+++ b/java/org/apache/jasper/Options.java
@@ -109,16 +109,6 @@ public interface Options {
*/
public TrimSpacesOption getTrimSpaces();
- /**
- * Gets the class-id value that is sent to Internet Explorer when using
- * <jsp:plugin> tags.
- * @return Class-id value
- *
- * @deprecated Will be removed in Tomcat 10.1.x
- */
- @Deprecated
- public String getIeClassId();
-
/**
* @return the work folder
*/
diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java
index 7688b20bcf..ec0f0d455c 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -49,7 +49,6 @@ import jakarta.servlet.jsp.tagext.TagInfo;
import jakarta.servlet.jsp.tagext.TagVariableInfo;
import jakarta.servlet.jsp.tagext.VariableInfo;
-import org.apache.jasper.Constants;
import org.apache.jasper.JasperException;
import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.TrimSpacesOption;
@@ -1539,251 +1538,11 @@ class Generator {
n.setEndJavaLine(out.getJavaLine());
}
- /**
- * @return a string for the form 'attr = "value"'
- */
- private String makeAttr(String attr, String value) {
- if (value == null) {
- return "";
- }
-
- return " " + attr + "=\"" + value + '\"';
- }
-
@Override
public void visit(Node.PlugIn n) throws JasperException {
- /**
- * A visitor to handle <jsp:param> in a plugin
- */
- class ParamVisitor extends Node.Visitor {
-
- private final boolean ie;
-
- ParamVisitor(boolean ie) {
- this.ie = ie;
- }
-
- @Override
- public void visit(Node.ParamAction n) throws JasperException {
-
- String name = n.getTextAttribute("name");
- if (name.equalsIgnoreCase("object")) {
- name = "java_object";
- } else if (name.equalsIgnoreCase("type")) {
- name = "java_type";
- }
-
- n.setBeginJavaLine(out.getJavaLine());
- // XXX - Fixed a bug here - value used to be output
- // inline, which is only okay if value is not an EL
- // expression. Also, key/value pairs for the
- // embed tag were not being generated correctly.
- // Double check that this is now the correct behavior.
- if (ie) {
- // We want something of the form
- // out.println( "<param name=\"blah\"
- // value=\"" + ... + "\">" );
- out.printil("out.write( \"<param name=\\\"" +
- escape(name) +
- "\\\" value=\\\"\" + " +
- attributeValue(n.getValue(), false,
- String.class) +
- " + \"\\\">\" );");
- out.printil("out.write(\"\\n\");");
- } else {
- // We want something of the form
- // out.print( " blah=\"" + ... + "\"" );
- out.printil("out.write( \" " +
- escape(name) +
- "=\\\"\" + " +
- attributeValue(n.getValue(), false,
- String.class) +
- " + \"\\\"\" );");
- }
-
- n.setEndJavaLine(out.getJavaLine());
- }
- }
-
- String type = n.getTextAttribute("type");
- String code = n.getTextAttribute("code");
- String name = n.getTextAttribute("name");
- Node.JspAttribute height = n.getHeight();
- Node.JspAttribute width = n.getWidth();
- String hspace = n.getTextAttribute("hspace");
- String vspace = n.getTextAttribute("vspace");
- String align = n.getTextAttribute("align");
- String iepluginurl = n.getTextAttribute("iepluginurl");
- String nspluginurl = n.getTextAttribute("nspluginurl");
- String codebase = n.getTextAttribute("codebase");
- String archive = n.getTextAttribute("archive");
- String jreversion = n.getTextAttribute("jreversion");
-
- String widthStr = null;
- if (width != null) {
- if (width.isNamedAttribute()) {
- widthStr = generateNamedAttributeValue(width
- .getNamedAttributeNode());
- } else {
- widthStr = attributeValue(width, false, String.class);
- }
- }
-
- String heightStr = null;
- if (height != null) {
- if (height.isNamedAttribute()) {
- heightStr = generateNamedAttributeValue(height
- .getNamedAttributeNode());
- } else {
- heightStr = attributeValue(height, false, String.class);
- }
- }
-
- if (iepluginurl == null) {
- iepluginurl = Constants.IE_PLUGIN_URL;
- }
- if (nspluginurl == null) {
- nspluginurl = Constants.NS_PLUGIN_URL;
- }
-
+ // As of JSP 3.1, jsp:plugin must not generate any output
n.setBeginJavaLine(out.getJavaLine());
-
- // If any of the params have their values specified by
- // jsp:attribute, prepare those values first.
- // Look for a params node and prepare its param subelements:
- Node.JspBody jspBody = findJspBody(n);
- if (jspBody != null) {
- Node.Nodes subelements = jspBody.getBody();
- if (subelements != null) {
- for (int i = 0; i < subelements.size(); i++) {
- Node m = subelements.getNode(i);
- if (m instanceof Node.ParamsAction) {
- prepareParams(m);
- break;
- }
- }
- }
- }
-
- // XXX - Fixed a bug here - width and height can be set
- // dynamically. Double-check if this generation is correct.
-
- // IE style plugin
- // <object ...>
- // First compose the runtime output string
- String s0 = "<object"
- + makeAttr("classid", ctxt.getOptions().getIeClassId())
- + makeAttr("name", name);
-
- String s1 = "";
- if (width != null) {
- s1 = " + \" width=\\\"\" + " + widthStr + " + \"\\\"\"";
- }
-
- String s2 = "";
- if (height != null) {
- s2 = " + \" height=\\\"\" + " + heightStr + " + \"\\\"\"";
- }
-
- String s3 = makeAttr("hspace", hspace) + makeAttr("vspace", vspace)
- + makeAttr("align", align)
- + makeAttr("codebase", iepluginurl) + '>';
-
- // Then print the output string to the java file
- out.printil("out.write(" + quote(s0) + s1 + s2 + " + " + quote(s3)
- + ");");
- out.printil("out.write(\"\\n\");");
-
- // <param > for java_code
- s0 = "<param name=\"java_code\"" + makeAttr("value", code) + '>';
- out.printil("out.write(" + quote(s0) + ");");
- out.printil("out.write(\"\\n\");");
-
- // <param > for java_codebase
- if (codebase != null) {
- s0 = "<param name=\"java_codebase\""
- + makeAttr("value", codebase) + '>';
- out.printil("out.write(" + quote(s0) + ");");
- out.printil("out.write(\"\\n\");");
- }
-
- // <param > for java_archive
- if (archive != null) {
- s0 = "<param name=\"java_archive\""
- + makeAttr("value", archive) + '>';
- out.printil("out.write(" + quote(s0) + ");");
- out.printil("out.write(\"\\n\");");
- }
-
- // <param > for type
- s0 = "<param name=\"type\""
- + makeAttr("value", "application/x-java-"
- + type
- + ((jreversion == null) ? "" : ";version="
- + jreversion)) + '>';
- out.printil("out.write(" + quote(s0) + ");");
- out.printil("out.write(\"\\n\");");
-
- /*
- * generate a <param> for each <jsp:param> in the plugin body
- */
- if (n.getBody() != null) {
- n.getBody().visit(new ParamVisitor(true));
- }
-
- /*
- * Netscape style plugin part
- */
- out.printil("out.write(" + quote("<comment>") + ");");
- out.printil("out.write(\"\\n\");");
- s0 = "<EMBED"
- + makeAttr("type", "application/x-java-"
- + type
- + ((jreversion == null) ? "" : ";version="
- + jreversion)) + makeAttr("name", name);
-
- // s1 and s2 are the same as before.
-
- s3 = makeAttr("hspace", hspace) + makeAttr("vspace", vspace)
- + makeAttr("align", align)
- + makeAttr("pluginspage", nspluginurl)
- + makeAttr("java_code", code)
- + makeAttr("java_codebase", codebase)
- + makeAttr("java_archive", archive);
- out.printil("out.write(" + quote(s0) + s1 + s2 + " + " + quote(s3)
- + ");");
-
- /*
- * Generate a 'attr = "value"' for each <jsp:param> in plugin body
- */
- if (n.getBody() != null) {
- n.getBody().visit(new ParamVisitor(false));
- }
-
- out.printil("out.write(" + quote("/>") + ");");
- out.printil("out.write(\"\\n\");");
-
- out.printil("out.write(" + quote("<noembed>") + ");");
- out.printil("out.write(\"\\n\");");
-
- /*
- * Fallback
- */
- if (n.getBody() != null) {
- visitBody(n);
- out.printil("out.write(\"\\n\");");
- }
-
- out.printil("out.write(" + quote("</noembed>") + ");");
- out.printil("out.write(\"\\n\");");
-
- out.printil("out.write(" + quote("</comment>") + ");");
- out.printil("out.write(\"\\n\");");
-
- out.printil("out.write(" + quote("</object>") + ");");
- out.printil("out.write(\"\\n\");");
-
n.setEndJavaLine(out.getJavaLine());
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c90268aad5..169f491a8b 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -131,6 +131,17 @@
</add>
</changelog>
</subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <update>
+ To align with the JSP 3.1 specification, make the
+ <code>jsp:pluing</code> action a NO-OP. No HTML will be generated as a
+ result the <code>jsp:pluing</code> action being included in a JSP. This
+ is be because the associated HTML elements are no longer supported by
+ any major browser. (markt)
+ </update>
+ </changelog>
+ </subsection>
</section>
<section name="Tomcat 10.1.0-M14 (markt)" rtext="2022-04-01">
<subsection name="Catalina">
diff --git a/webapps/docs/jasper-howto.xml b/webapps/docs/jasper-howto.xml
index 98ec52e636..d822d41c39 100644
--- a/webapps/docs/jasper-howto.xml
+++ b/webapps/docs/jasper-howto.xml
@@ -147,11 +147,6 @@ performed in a separate JVM from Tomcat? <code>true</code> or
<li><strong>genStringAsCharArray</strong> - Should text strings be generated as char
arrays, to improve performance in some cases? Default <code>false</code>.</li>
-<li><strong>ieClassId</strong> - Deprecated. Will be removed in Tomact 10.1.
-The class-id value to be sent to Internet
-Explorer when using <jsp:plugin> tags. Default
-<code>clsid:8AD9C840-044E-11D1-B3E9-00805F499D93</code>.</li>
-
<li><strong>javaEncoding</strong> - Java file encoding to use for generating
java source files. Default <code>UTF8</code>.</li>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org