Author: remy.maucherat(a)jboss.com
Date: 2010-03-25 15:47:57 -0400 (Thu, 25 Mar 2010)
New Revision: 1422
Modified:
trunk/java/org/apache/jasper/EmbeddedServletOptions.java
trunk/java/org/apache/jasper/JspCompilationContext.java
trunk/java/org/apache/jasper/Options.java
trunk/java/org/apache/jasper/compiler/Generator.java
trunk/java/org/apache/jasper/resources/LocalStrings.properties
trunk/webapps/docs/changelog.xml
Log:
- Port Jasper patches.
Modified: trunk/java/org/apache/jasper/EmbeddedServletOptions.java
===================================================================
--- trunk/java/org/apache/jasper/EmbeddedServletOptions.java 2010-03-25 17:19:10 UTC (rev
1421)
+++ trunk/java/org/apache/jasper/EmbeddedServletOptions.java 2010-03-25 19:47:57 UTC (rev
1422)
@@ -171,6 +171,11 @@
private int modificationTestInterval = 4;
/**
+ * Is re-compilation attempted immediately after a failure?
+ */
+ private boolean recompileOnFail = false;
+
+ /**
* Is generation of X-Powered-By response header enabled/disabled?
*/
private boolean xpoweredBy;
@@ -246,6 +251,13 @@
}
/**
+ * Re-compile on failure.
+ */
+ public boolean getRecompileOnFail() {
+ return recompileOnFail;
+ }
+
+ /**
* Is Jasper being used in development mode?
*/
public boolean getDevelopment() {
@@ -485,6 +497,16 @@
}
}
+ String recompileOnFail = config.getInitParameter("recompileOnFail");
+ if (recompileOnFail != null) {
+ if (recompileOnFail.equalsIgnoreCase("true")) {
+ this.recompileOnFail = true;
+ } else if (recompileOnFail.equalsIgnoreCase("false")) {
+ this.recompileOnFail = false;
+ } else {
+ log.warn(Localizer.getMessage("jsp.warning.recompileOnFail"));
+ }
+ }
String development = config.getInitParameter("development");
if (development != null) {
if (development.equalsIgnoreCase("true")) {
Modified: trunk/java/org/apache/jasper/JspCompilationContext.java
===================================================================
--- trunk/java/org/apache/jasper/JspCompilationContext.java 2010-03-25 17:19:10 UTC (rev
1421)
+++ trunk/java/org/apache/jasper/JspCompilationContext.java 2010-03-25 19:47:57 UTC (rev
1422)
@@ -23,7 +23,6 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -305,6 +304,9 @@
}
if (jarUrl != null) {
result = new URL(jarUrl.toExternalForm() + res.substring(1));
+ } else {
+ // May not be in a JAR in some IDE environments
+ result = context.getResource(canonicalURI(res));
}
} else if (res.startsWith("jar:file:")) {
// This is a tag file packaged in a jar that is being checked
@@ -608,6 +610,10 @@
} catch (JasperException ex) {
// Cache compilation exception
jsw.setCompilationException(ex);
+ if (options.getDevelopment() && options.getRecompileOnFail()) {
+ // Force a recompilation attempt on next access
+ jsw.setLastModificationTest(-1);
+ }
throw ex;
} catch (Exception ex) {
JasperException je = new JasperException(
Modified: trunk/java/org/apache/jasper/Options.java
===================================================================
--- trunk/java/org/apache/jasper/Options.java 2010-03-25 17:19:10 UTC (rev 1421)
+++ trunk/java/org/apache/jasper/Options.java 2010-03-25 19:47:57 UTC (rev 1422)
@@ -170,6 +170,11 @@
public int getModificationTestInterval();
/**
+ * Re-compile on failure.
+ */
+ public boolean getRecompileOnFail();
+
+ /**
* Is caching enabled (used for precompilation).
*/
public boolean isCaching();
Modified: trunk/java/org/apache/jasper/compiler/Generator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Generator.java 2010-03-25 17:19:10 UTC (rev
1421)
+++ trunk/java/org/apache/jasper/compiler/Generator.java 2010-03-25 19:47:57 UTC (rev
1422)
@@ -78,6 +78,15 @@
private static final String VAR_INSTANCEMANAGER =
System.getProperty("org.apache.jasper.compiler.Generator.VAR_INSTANCEMANAGER",
"_jsp_instancemanager");
+ /* System property that controls if the requirement to have the object
+ * used in jsp:getProperty action to be previously "introduced"
+ * to the JSP processor (see JSP.5.3) is enforced.
+ */
+ private static final boolean STRICT_GET_PROPERTY = Boolean.valueOf(
+ System.getProperty(
+
"org.apache.jasper.compiler.Generator.STRICT_GET_PROPERTY",
+ "true")).booleanValue();
+
private ServletWriter out;
private ArrayList methodsBuffered;
@@ -1064,7 +1073,7 @@
+ ")_jspx_page_context.findAttribute("
+ "\""
+ name + "\"))." + methodName +
"())));");
- } else if (varInfoNames.contains(name)) {
+ } else if (!STRICT_GET_PROPERTY || varInfoNames.contains(name)) {
// The object is a custom action with an associated
// VariableInfo entry for this name.
// Get the class name and then introspect at runtime.
@@ -1712,6 +1721,21 @@
pageInfo.getVarInfoNames().add(info.getVarName());
}
}
+ TagVariableInfo[] tagInfos = n.getTagVariableInfos();
+ if (tagInfos != null && tagInfos.length > 0) {
+ for (int i = 0; i < tagInfos.length; i++) {
+ TagVariableInfo tagInfo = tagInfos[i];
+ if (tagInfo != null) {
+ String name = tagInfo.getNameGiven();
+ if (name == null) {
+ String nameFromAttribute =
+ tagInfo.getNameFromAttribute();
+ name = n.getAttributeValue(nameFromAttribute);
+ }
+ pageInfo.getVarInfoNames().add(name);
+ }
+ }
+ }
if (n.implementsSimpleTag()) {
generateCustomDoTag(n, handlerInfo, tagHandlerVar);
Modified: trunk/java/org/apache/jasper/resources/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/jasper/resources/LocalStrings.properties 2010-03-25 17:19:10 UTC
(rev 1421)
+++ trunk/java/org/apache/jasper/resources/LocalStrings.properties 2010-03-25 19:47:57 UTC
(rev 1422)
@@ -155,6 +155,7 @@
jsp.warning.classDebugInfo=Warning: Invalid value for the initParam classdebuginfo. Will
use the default value of \"false\"
jsp.warning.checkInterval=Warning: Invalid value for the initParam checkInterval. Will
use the default value of \"300\" seconds
jsp.warning.modificationTestInterval=Warning: Invalid value for the initParam
modificationTestInterval. Will use the default value of \"4\" seconds
+jsp.warning.recompileOnFail=Warning: Invalid value for the initParam recompileOnFail.
Will use the default value of \"false\" seconds
jsp.warning.development=Warning: Invalid value for the initParam development. Will use
the default value of \"true\"
jsp.warning.fork=Warning: Invalid value for the initParam fork. Will use the default
value of \"true\"
jsp.warning.reloading=Warning: Invalid value for the initParam reloading. Will use the
default value of \"true\"
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2010-03-25 17:19:10 UTC (rev 1421)
+++ trunk/webapps/docs/changelog.xml 2010-03-25 19:47:57 UTC (rev 1422)
@@ -40,6 +40,14 @@
<bug>48668</bug>: Honor isELIgnored and isDeferredSyntaxAllowed in
the Parser.
ELParser is now aware of the isDeferredAsLiteral option. (kkolinko)
</fix>
+ <fix>
+ <bug>48701</bug>: Allow TagVariableInfo as well as VariableInfo to
introduce
+ objects later used by jsp:getProperty. (markt)
+ </fix>
+ <update>
+ <bug>48795</bug>: Add a new property to control if the next request
always
+ triggers recompilation after a compilation failure. (markt)
+ </update>
</changelog>
</subsection>
</section>
Show replies by date