JBossWeb SVN: r1139 - in trunk: java/org/apache/jasper/compiler and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-07-20 12:46:09 -0400 (Mon, 20 Jul 2009)
New Revision: 1139
Modified:
trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
trunk/java/org/apache/jasper/compiler/Generator.java
trunk/java/org/apache/jasper/compiler/JspConfig.java
trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
trunk/java/org/apache/tomcat/util/res/StringManager.java
trunk/webapps/docs/changelog.xml
Log:
- Port Tomcat patches.
- JspConfig needs reasonable thread safety.
- Type coercion for certain EL expressions.
- Improve StringManager.
Modified: trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
===================================================================
--- trunk/java/org/apache/catalina/filters/WebdavFixFilter.java 2009-07-20 16:06:34 UTC (rev 1138)
+++ trunk/java/org/apache/catalina/filters/WebdavFixFilter.java 2009-07-20 16:46:09 UTC (rev 1139)
@@ -74,11 +74,9 @@
private static final String UA_MINIDIR_5_2_3790 =
"Microsoft-WebDAV-MiniRedir/5.2.3790";
- @Override
public void init(FilterConfig filterConfig) throws ServletException {
}
- @Override
public void destroy() {
}
@@ -86,7 +84,6 @@
* Check for the broken MS WebDAV client and if detected issue a re-direct
* that hopefully will cause the non-broken client to be used.
*/
- @Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if (!(request instanceof HttpServletRequest) ||
Modified: trunk/java/org/apache/jasper/compiler/Generator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Generator.java 2009-07-20 16:06:34 UTC (rev 1138)
+++ trunk/java/org/apache/jasper/compiler/Generator.java 2009-07-20 16:46:09 UTC (rev 1139)
@@ -863,6 +863,10 @@
// Composite expression - must coerce to String
type = String.class;
}
+ if (i+1 < size) {
+ // Composite expression - must coerce to String
+ type = String.class;
+ }
output.append(quote(tx.substring(mark, i)));
}
mark = i;
Modified: trunk/java/org/apache/jasper/compiler/JspConfig.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/JspConfig.java 2009-07-20 16:06:34 UTC (rev 1138)
+++ trunk/java/org/apache/jasper/compiler/JspConfig.java 2009-07-20 16:46:09 UTC (rev 1139)
@@ -92,88 +92,91 @@
private void init() throws JasperException {
if (!initialized) {
- //processWebDotXml(ctxt);
- HashMap<String, org.apache.catalina.deploy.JspPropertyGroup> jspPropertyGroups =
- (HashMap<String, org.apache.catalina.deploy.JspPropertyGroup>)
- ctxt.getAttribute(Globals.JSP_PROPERTY_GROUPS);
+ synchronized (this) {
+ if (!initialized) {
+ HashMap<String, org.apache.catalina.deploy.JspPropertyGroup> jspPropertyGroups =
+ (HashMap<String, org.apache.catalina.deploy.JspPropertyGroup>)
+ ctxt.getAttribute(Globals.JSP_PROPERTY_GROUPS);
- String versionString = (String) ctxt.getAttribute(Globals.SERVLET_VERSION);
- double version = 2.3;
- if (versionString != null) {
- try {
- version = Double.parseDouble(versionString);
- } catch (NumberFormatException e) {
- }
- }
- if (version < 2.4) {
- defaultIsELIgnored = "true";
- }
-
- jspProperties = new ArrayList<JspPropertyGroup>();
- Iterator<String> urlPatternIterator = jspPropertyGroups.keySet().iterator();
- while (urlPatternIterator.hasNext()) {
- String urlPattern = urlPatternIterator.next();
- org.apache.catalina.deploy.JspPropertyGroup jspPropertyGroup =
- jspPropertyGroups.get(urlPattern);
-
- String path = null;
- String extension = null;
-
- if (urlPattern.indexOf('*') < 0) {
- // Exact match
- path = urlPattern;
- } else {
- int i = urlPattern.lastIndexOf('/');
- String file;
- if (i >= 0) {
- path = urlPattern.substring(0,i+1);
- file = urlPattern.substring(i+1);
- } else {
- file = urlPattern;
+ String versionString = (String) ctxt.getAttribute(Globals.SERVLET_VERSION);
+ double version = 2.3;
+ if (versionString != null) {
+ try {
+ version = Double.parseDouble(versionString);
+ } catch (NumberFormatException e) {
+ }
}
+ if (version < 2.4) {
+ defaultIsELIgnored = "true";
+ }
- // pattern must be "*", or of the form "*.jsp"
- if (file.equals("*")) {
- extension = "*";
- } else if (file.startsWith("*.")) {
- extension = file.substring(file.indexOf('.')+1);
+ jspProperties = new ArrayList<JspPropertyGroup>();
+ Iterator<String> urlPatternIterator = jspPropertyGroups.keySet().iterator();
+ while (urlPatternIterator.hasNext()) {
+ String urlPattern = urlPatternIterator.next();
+ org.apache.catalina.deploy.JspPropertyGroup jspPropertyGroup =
+ jspPropertyGroups.get(urlPattern);
+
+ String path = null;
+ String extension = null;
+
+ if (urlPattern.indexOf('*') < 0) {
+ // Exact match
+ path = urlPattern;
+ } else {
+ int i = urlPattern.lastIndexOf('/');
+ String file;
+ if (i >= 0) {
+ path = urlPattern.substring(0,i+1);
+ file = urlPattern.substring(i+1);
+ } else {
+ file = urlPattern;
+ }
+
+ // pattern must be "*", or of the form "*.jsp"
+ if (file.equals("*")) {
+ extension = "*";
+ } else if (file.startsWith("*.")) {
+ extension = file.substring(file.indexOf('.')+1);
+ }
+
+ // The url patterns are reconstructed as the follwoing:
+ // path != null, extension == null: / or /foo/bar.ext
+ // path == null, extension != null: *.ext
+ // path != null, extension == "*": /foo/*
+ boolean isStar = "*".equals(extension);
+ if ((path == null && (extension == null || isStar))
+ || (path != null && !isStar)) {
+ log.warn(Localizer.getMessage(
+ "jsp.warning.bad.urlpattern.propertygroup",
+ urlPattern));
+ continue;
+ }
+ }
+
+ JspProperty property = new JspProperty(jspPropertyGroup.getIsXml(),
+ jspPropertyGroup.getElIgnored(),
+ jspPropertyGroup.getScriptingInvalid(),
+ jspPropertyGroup.getPageEncoding(),
+ jspPropertyGroup.getIncludePreludes(),
+ jspPropertyGroup.getIncludeCodas(),
+ jspPropertyGroup.getDeferredSyntaxAllowedAsLiteral(),
+ jspPropertyGroup.getTrimDirectiveWhitespaces());
+ JspPropertyGroup propertyGroup =
+ new JspPropertyGroup(path, extension, property);
+
+ jspProperties.add(propertyGroup);
+
}
- // The url patterns are reconstructed as the follwoing:
- // path != null, extension == null: / or /foo/bar.ext
- // path == null, extension != null: *.ext
- // path != null, extension == "*": /foo/*
- boolean isStar = "*".equals(extension);
- if ((path == null && (extension == null || isStar))
- || (path != null && !isStar)) {
- log.warn(Localizer.getMessage(
- "jsp.warning.bad.urlpattern.propertygroup",
- urlPattern));
- continue;
- }
+ defaultJspProperty = new JspProperty(defaultIsXml,
+ defaultIsELIgnored,
+ defaultIsScriptingInvalid,
+ null, null, null, defaultDeferedSyntaxAllowedAsLiteral,
+ defaultTrimDirectiveWhitespaces);
+ initialized = true;
}
-
- JspProperty property = new JspProperty(jspPropertyGroup.getIsXml(),
- jspPropertyGroup.getElIgnored(),
- jspPropertyGroup.getScriptingInvalid(),
- jspPropertyGroup.getPageEncoding(),
- jspPropertyGroup.getIncludePreludes(),
- jspPropertyGroup.getIncludeCodas(),
- jspPropertyGroup.getDeferredSyntaxAllowedAsLiteral(),
- jspPropertyGroup.getTrimDirectiveWhitespaces());
- JspPropertyGroup propertyGroup =
- new JspPropertyGroup(path, extension, property);
-
- jspProperties.add(propertyGroup);
-
}
-
- defaultJspProperty = new JspProperty(defaultIsXml,
- defaultIsELIgnored,
- defaultIsScriptingInvalid,
- null, null, null, defaultDeferedSyntaxAllowedAsLiteral,
- defaultTrimDirectiveWhitespaces);
- initialized = true;
}
}
Modified: trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/TagHandlerPool.java 2009-07-20 16:06:34 UTC (rev 1138)
+++ trunk/java/org/apache/jasper/runtime/TagHandlerPool.java 2009-07-20 16:46:09 UTC (rev 1139)
@@ -24,7 +24,6 @@
import org.apache.jasper.Constants;
import org.apache.tomcat.InstanceManager;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
* Pool of tag handlers that can be reused.
@@ -35,8 +34,8 @@
private Tag[] handlers;
- public static String OPTION_TAGPOOL="tagpoolClassName";
- public static String OPTION_MAXSIZE="tagpoolMaxSize";
+ public static final String OPTION_TAGPOOL="tagpoolClassName";
+ public static final String OPTION_MAXSIZE="tagpoolMaxSize";
private Logger log = Logger.getLogger(TagHandlerPool.class);
Modified: trunk/java/org/apache/tomcat/util/res/StringManager.java
===================================================================
--- trunk/java/org/apache/tomcat/util/res/StringManager.java 2009-07-20 16:06:34 UTC (rev 1138)
+++ trunk/java/org/apache/tomcat/util/res/StringManager.java 2009-07-20 16:46:09 UTC (rev 1139)
@@ -69,9 +69,25 @@
*/
private StringManager(String packageName) {
String bundleName = packageName + ".LocalStrings";
- bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
+ try {
+ bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
+ } catch( MissingResourceException ex ) {
+ // Try from the current loader (that's the case for trusted apps)
+ // Should only be required if using a TC5 style classloader structure
+ // where common != shared != server
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if( cl != null ) {
+ try {
+ bundle = ResourceBundle.getBundle(
+ bundleName, Locale.getDefault(), cl);
+ } catch(MissingResourceException ex2) {
+ }
+ }
+ }
// Get the actual locale, which may be different from the requested one
- locale = bundle.getLocale();
+ if (bundle != null) {
+ locale = bundle.getLocale();
+ }
}
/**
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-07-20 16:06:34 UTC (rev 1138)
+++ trunk/webapps/docs/changelog.xml 2009-07-20 16:46:09 UTC (rev 1139)
@@ -162,6 +162,12 @@
<fix>
<bug>38797</bug>: Fix getProperty code to what it used to be in Tomcat 5.5.12. (markt)
</fix>
+ <fix>
+ <bug>41661</bug>: JspConfig.init() needs a minimal amount of thread safety. (markt)
+ </fix>
+ <fix>
+ <bug>47413</bug>: First part of a composite expression "${a}${b}" was not coerced to String. (kkolinko)
+ </fix>
</changelog>
</subsection>
</section>
15 years, 5 months
JBossWeb SVN: r1138 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-07-20 12:06:34 -0400 (Mon, 20 Jul 2009)
New Revision: 1138
Modified:
trunk/java/org/apache/catalina/loader/WebappClassLoader.java
trunk/webapps/docs/changelog.xml
Log:
- Port clear reference fix.
Modified: trunk/java/org/apache/catalina/loader/WebappClassLoader.java
===================================================================
--- trunk/java/org/apache/catalina/loader/WebappClassLoader.java 2009-07-17 15:18:55 UTC (rev 1137)
+++ trunk/java/org/apache/catalina/loader/WebappClassLoader.java 2009-07-20 16:06:34 UTC (rev 1138)
@@ -267,19 +267,6 @@
protected boolean delegate = false;
- /**
- * Last time a JAR was accessed.
- */
- //protected long lastJarAccessed = 0L;
-
-
- /**
- * The list of local repositories, in the order they should be searched
- * for locally loaded classes or resources.
- */
- //protected String[] repositories = new String[0];
-
-
/**
* Repositories URLs, used to cache the result of getURLs.
*/
@@ -287,55 +274,6 @@
/**
- * Repositories translated as path in the work directory (for Jasper
- * originally), but which is used to generate fake URLs should getURLs be
- * called.
- */
- //protected File[] files = new File[0];
-
-
- /**
- * The list of JARs, in the order they should be searched
- * for locally loaded classes or resources.
- */
- //protected JarFile[] jarFiles = new JarFile[0];
-
-
- /**
- * The list of JARs, in the order they should be searched
- * for locally loaded classes or resources.
- */
- //protected File[] jarRealFiles = new File[0];
-
-
- /**
- * The path which will be monitored for added Jar files.
- */
- //protected String jarPath = null;
-
-
- /**
- * The list of JARs, in the order they should be searched
- * for locally loaded classes or resources.
- */
- //protected String[] jarNames = new String[0];
-
-
- /**
- * The list of JARs last modified dates, in the order they should be
- * searched for locally loaded classes or resources.
- */
- //protected long[] lastModifiedDates = new long[0];
-
-
- /**
- * The list of resources which should be checked when checking for
- * modifications.
- */
- //protected String[] paths = new String[0];
-
-
- /**
* A list of read File and Jndi Permission's required if this loader
* is for a web application context.
*/
@@ -380,11 +318,6 @@
/**
- * Has external repositories.
- */
- //protected boolean hasExternalRepositories = false;
-
- /**
* need conversion for properties files
*/
protected boolean needConvert = false;
@@ -1214,7 +1147,30 @@
// Null out any static or final fields from loaded classes,
// as a workaround for apparent garbage collection bugs
if (ENABLE_CLEAR_REFERENCES) {
- Iterator loadedClasses = resourceEntries.values().iterator();
+ java.util.Collection<ResourceEntry> values = resourceEntries.values();
+ Iterator<ResourceEntry> loadedClasses = values.iterator();
+ //
+ // walk through all loaded class to trigger initialization for
+ // any uninitialized classes, otherwise initialization of
+ // one class may call a previously cleared class.
+ while(loadedClasses.hasNext()) {
+ ResourceEntry entry = loadedClasses.next();
+ if (entry.loadedClass != null) {
+ Class<?> clazz = entry.loadedClass;
+ try {
+ Field[] fields = clazz.getDeclaredFields();
+ for (int i = 0; i < fields.length; i++) {
+ if(Modifier.isStatic(fields[i].getModifiers())) {
+ fields[i].get(null);
+ break;
+ }
+ }
+ } catch(Throwable t) {
+ // Ignore
+ }
+ }
+ }
+ loadedClasses = values.iterator();
while (loadedClasses.hasNext()) {
ResourceEntry entry = (ResourceEntry) loadedClasses.next();
if (entry.loadedClass != null) {
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-07-17 15:18:55 UTC (rev 1137)
+++ trunk/webapps/docs/changelog.xml 2009-07-20 16:06:34 UTC (rev 1138)
@@ -123,6 +123,10 @@
<add>
All other Servlet 3.0 features. (remm)
</add>
+ <fix>
+ <bug>41059</bug>: Reduce one possible source of errors if using ENABLE_CLEAR_REFERENCES=true.
+ Patch by Curt Arnold. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
15 years, 5 months
JBossWeb SVN: r1137 - in trunk: java/org/apache/catalina/core and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-07-17 11:18:55 -0400 (Fri, 17 Jul 2009)
New Revision: 1137
Modified:
trunk/java/javax/servlet/ServletContext.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
trunk/webapps/docs/changelog.xml
Log:
- Today's spec update (sigh).
Modified: trunk/java/javax/servlet/ServletContext.java
===================================================================
--- trunk/java/javax/servlet/ServletContext.java 2009-07-16 17:05:56 UTC (rev 1136)
+++ trunk/java/javax/servlet/ServletContext.java 2009-07-17 15:18:55 UTC (rev 1137)
@@ -787,7 +787,7 @@
* is registered with this ServletContext via a call to
* {@link #addServlet(String,Servlet)}.
*
- * @param c the Servlet class to instantiate
+ * @param clazz the Servlet class to instantiate
*
* @return the new Servlet instance
*
@@ -802,10 +802,9 @@
*
* @since Servlet 3.0
*/
- public <T extends Servlet> T createServlet(Class<T> c)
+ public <T extends Servlet> T createServlet(Class<T> clazz)
throws ServletException;
-
/**
* Gets the ServletRegistration corresponding to the servlet with the
* given <tt>servletName</tt>.
@@ -947,7 +946,7 @@
* is registered with this ServletContext via a call to
* {@link #addFilter(String,Filter)}.
*
- * @param c the Filter class to instantiate
+ * @param clazz the Filter class to instantiate
*
* @return the new Filter instance
*
@@ -962,7 +961,7 @@
*
* @since Servlet 3.0
*/
- public <T extends Filter> T createFilter(Class<T> c)
+ public <T extends Filter> T createFilter(Class<T> clazz)
throws ServletException;
@@ -1245,7 +1244,55 @@
*/
public void addListener(Class <? extends EventListener> listenerClass);
+
/**
+ * Instantiates the given EventListener class and performs any
+ * required resource injection into the new EventListener instance
+ * before returning it.
+ *
+ * <p>The specified EventListener class must implement at least one of
+ * the <code>{@link ServletContextListener}</code>,
+ * <code>{@link ServletContextAttributeListener}</code>,
+ * <code>{@link ServletRequestListener}</code>,
+ * <code>{@link ServletRequestAttributeListener}</code>,
+ * <code>{@link javax.servlet.http.HttpSessionListener}</code>, or
+ * <code>{@link javax.servlet.http.HttpSessionAttributeListener}</code>
+ * interfaces.
+ *
+ * <p>The returned EventListener instance may be further customized
+ * before it is registered with this ServletContext via a call to
+ * {@link #addListener(EventListener)}.
+ *
+ * @param clazz the EventListener class to instantiate
+ *
+ * @return the new EventListener instance
+ *
+ * @throws ServletException if an error occurs during the instantiation
+ * of, or resource injection into the new EventListener
+ *
+ * @throws IllegalStateException if this ServletContext was passed to the
+ * {@link ServletContextListener#contextInitialized} method of a
+ * {@link ServletContextListener} that was not declared in
+ * <code>web.xml</code> or <code>web-fragment.xml</code>, or annotated
+ * with {@link javax.servlet.annotation.WebListener}
+ *
+ * @throws IllegalArgumentException if the specified EventListener class
+ * does not implement any of the
+ * <code>{@link ServletContextListener}</code>,
+ * <code>{@link ServletContextAttributeListener}</code>,
+ * <code>{@link ServletRequestListener}</code>,
+ * <code>{@link ServletRequestAttributeListener}</code>,
+ * <code>{@link javax.servlet.http.HttpSessionListener}</code>, or
+ * <code>{@link javax.servlet.http.HttpSessionAttributeListener}</code>
+ * interfaces.
+ *
+ * @since Servlet 3.0
+ */
+ public <T extends EventListener> T createListener(Class<T> clazz)
+ throws ServletException;
+
+
+ /**
* Gets the <code><jsp-config></code> related configuration
* that was aggregated from the <code>web.xml</code> and
* <code>web-fragment.xml</code> descriptor files of the web application
@@ -1263,6 +1310,17 @@
*/
public JspConfigDescriptor getJspConfigDescriptor();
+
+ /**
+ * Gets the classloader of the web application represented by this
+ * ServletContext.
+ *
+ * @return the classloader of the web application represented by this
+ * ServletContext
+ *
+ * @since Servlet 3.0
+ */
+ public ClassLoader getClassLoader();
}
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-07-16 17:05:56 UTC (rev 1136)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-07-17 15:18:55 UTC (rev 1137)
@@ -1082,7 +1082,9 @@
}
// FIXME: forbidden if the listener is from a TLD
try {
- context.addApplicationListenerInstance(listenerClass.newInstance());
+ EventListener listenerInstance =
+ (EventListener) context.getInstanceManager().newInstance(listenerClass);
+ context.addApplicationListenerInstance(listenerInstance);
} catch (Exception e) {
// FIXME: better error
throw new IllegalStateException(e);
@@ -1090,6 +1092,28 @@
}
+ public <T extends EventListener> T createListener(Class<T> clazz)
+ throws ServletException {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
+ getContextPath()));
+ }
+ T listenerInstance = null;
+ try {
+ listenerInstance = (T) context.getInstanceManager().newInstance(clazz);
+ } catch (Exception e) {
+ // FIXME: better error
+ throw new ServletException(e);
+ }
+ return listenerInstance;
+ }
+
+
+ public ClassLoader getClassLoader() {
+ return context.getLoader().getClassLoader();
+ }
+
+
public JspConfigDescriptor getJspConfigDescriptor() {
ArrayList<TaglibDescriptor> taglibDescriptors = new ArrayList<TaglibDescriptor>();
String[] taglibURIs = context.findTaglibs();
Modified: trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-07-16 17:05:56 UTC (rev 1136)
+++ trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-07-17 15:18:55 UTC (rev 1137)
@@ -607,6 +607,25 @@
}
+ public <T extends EventListener> T createListener(Class<T> clazz)
+ throws ServletException {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (T) doPrivileged("createListener", new Object[]{clazz});
+ } else {
+ return context.createListener(clazz);
+ }
+ }
+
+
+ public ClassLoader getClassLoader() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (ClassLoader) doPrivileged("getClassLoader", null);
+ } else {
+ return context.getClassLoader();
+ }
+ }
+
+
public JspConfigDescriptor getJspConfigDescriptor() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (JspConfigDescriptor) doPrivileged("getJspConfigDescriptor", null);
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-07-16 17:05:56 UTC (rev 1136)
+++ trunk/webapps/docs/changelog.xml 2009-07-17 15:18:55 UTC (rev 1137)
@@ -20,7 +20,7 @@
<subsection name="General">
<changelog>
<update>
- Servlet 3.0 API. (markt, remm)
+ Servlet 3.0 API. (remm)
</update>
<update>
Commons Pool 1.5.2. (markt)
@@ -72,7 +72,7 @@
<bug>46562</bug>: In SSI, close the reader when done. (markt)
</fix>
<add>
- AsyncContext implementation. (remm)
+ AsyncContext implementation, internally built on top of the event API. (remm)
</add>
<add>
Multipart implementation. (remm)
@@ -120,6 +120,9 @@
<fix>
<bug>37984</bug>: Strip {MD5} as well as {SHA} from digested passwords. (markt)
</fix>
+ <add>
+ All other Servlet 3.0 features. (remm)
+ </add>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -128,7 +131,7 @@
Remove useless instanceof in the HTTP protocol. (markt)
</fix>
<update>
- Add support for non IO events in all connectors. (remm)
+ Add support for non IO based events in all AJP and HTTP connectors. (remm)
</update>
<fix>
Fix handling of timeout values <= 0 with the poller refactoring. (remm)
15 years, 5 months
JBossWeb SVN: r1136 - in trunk/java/org/apache/catalina: core and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-07-16 13:05:56 -0400 (Thu, 16 Jul 2009)
New Revision: 1136
Modified:
trunk/java/org/apache/catalina/Context.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
trunk/java/org/apache/catalina/core/StandardContext.java
Log:
- Implement the JSP config metadata (which I won't use).
- Add the new addListener methods (with the missing TLD check, it's annoying).
Modified: trunk/java/org/apache/catalina/Context.java
===================================================================
--- trunk/java/org/apache/catalina/Context.java 2009-07-16 00:36:42 UTC (rev 1135)
+++ trunk/java/org/apache/catalina/Context.java 2009-07-16 17:05:56 UTC (rev 1136)
@@ -19,6 +19,8 @@
package org.apache.catalina;
+import java.util.EventListener;
+
import javax.servlet.ServletContext;
import org.apache.catalina.deploy.ApplicationParameter;
@@ -529,6 +531,15 @@
/**
+ * Add a new Listener instance to the set of Listeners
+ * configured for this application.
+ *
+ * @param listener Java instance of a listener
+ */
+ public <T extends EventListener> void addApplicationListenerInstance(T listener);
+
+
+ /**
* Add a new application parameter for this application.
*
* @param parameter The new application parameter
@@ -803,6 +814,12 @@
/**
+ * Return the set of JSP property groups.
+ */
+ public JspPropertyGroup[] findJspPropertyGroups();
+
+
+ /**
* Return the MIME type to which the specified extension is mapped,
* if any; otherwise return <code>null</code>.
*
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-07-16 00:36:42 UTC (rev 1135)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-07-16 17:05:56 UTC (rev 1136)
@@ -76,6 +76,8 @@
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
import javax.servlet.descriptor.JspConfigDescriptor;
+import javax.servlet.descriptor.JspPropertyGroupDescriptor;
+import javax.servlet.descriptor.TaglibDescriptor;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
@@ -84,6 +86,7 @@
import org.apache.catalina.Wrapper;
import org.apache.catalina.deploy.ApplicationParameter;
import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.deploy.JspPropertyGroup;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.ResourceSet;
@@ -1052,6 +1055,60 @@
}
+ public void addListener(String className) {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
+ getContextPath()));
+ }
+ // FIXME: forbidden if the listener is from a TLD
+ context.addApplicationListener(className);
+ }
+
+
+ public <T extends EventListener> void addListener(T listener) {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
+ getContextPath()));
+ }
+ // FIXME: forbidden if the listener is from a TLD
+ context.addApplicationListenerInstance(listener);
+ }
+
+
+ public void addListener(Class<? extends EventListener> listenerClass) {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
+ getContextPath()));
+ }
+ // FIXME: forbidden if the listener is from a TLD
+ try {
+ context.addApplicationListenerInstance(listenerClass.newInstance());
+ } catch (Exception e) {
+ // FIXME: better error
+ throw new IllegalStateException(e);
+ }
+ }
+
+
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ ArrayList<TaglibDescriptor> taglibDescriptors = new ArrayList<TaglibDescriptor>();
+ String[] taglibURIs = context.findTaglibs();
+ for (int i = 0; i < taglibURIs.length; i++) {
+ String taglibLocation = context.findTaglib(taglibURIs[i]);
+ TaglibDescriptor taglibDescriptor =
+ new TaglibDescriptorImpl(taglibURIs[i], taglibLocation);
+ taglibDescriptors.add(taglibDescriptor);
+ }
+ ArrayList<JspPropertyGroupDescriptor> jspPropertyGroupDescriptors =
+ new ArrayList<JspPropertyGroupDescriptor>();
+ JspPropertyGroup[] jspPropertyGroups = context.findJspPropertyGroups();
+ for (int i = 0; i < jspPropertyGroups.length; i++) {
+ jspPropertyGroupDescriptors.add(jspPropertyGroups[i]);
+ }
+ return new JspConfigDescriptorImpl(jspPropertyGroupDescriptors, taglibDescriptors);
+ }
+
+
// -------------------------------------------------------- Package Methods
protected StandardContext getContext() {
return this.context;
@@ -1190,33 +1247,51 @@
}
}
+
+ /**
+ * JSP config metadata class (not used for Jasper).
+ */
+ private static final class JspConfigDescriptorImpl implements JspConfigDescriptor {
- @Override
- public void addListener(String className) {
- // TODO Auto-generated method stub
-
- }
+ private Iterable<JspPropertyGroupDescriptor> jspPropertyGroups;
+ private Iterable<TaglibDescriptor> taglibs;
+ public JspConfigDescriptorImpl(Iterable<JspPropertyGroupDescriptor> jspPropertyGroups,
+ Iterable<TaglibDescriptor> taglibs) {
+ this.jspPropertyGroups = jspPropertyGroups;
+ this.taglibs = taglibs;
+ }
+ public Iterable<JspPropertyGroupDescriptor> getJspPropertyGroups() {
+ return jspPropertyGroups;
+ }
- @Override
- public <T extends EventListener> void addListener(T t) {
- // TODO Auto-generated method stub
+ public Iterable<TaglibDescriptor> getTaglibs() {
+ return taglibs;
+ }
}
+
+ /**
+ * JSP taglib descriptor metadata class (not used for Jasper).
+ */
+ private static final class TaglibDescriptorImpl implements TaglibDescriptor {
-
- @Override
- public void addListener(Class<? extends EventListener> listenerClass) {
- // TODO Auto-generated method stub
+ private String taglibLocation;
+ private String taglibURI;
- }
+ public TaglibDescriptorImpl(String taglibURI, String taglibLocation) {
+ this.taglibLocation = taglibLocation;
+ this.taglibURI = taglibURI;
+ }
+ public String getTaglibLocation() {
+ return taglibLocation;
+ }
- @Override
- public JspConfigDescriptor getJspConfigDescriptor() {
- // TODO Auto-generated method stub
- return null;
+ public String getTaglibURI() {
+ return taglibURI;
+ }
+
}
-
}
Modified: trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-07-16 00:36:42 UTC (rev 1135)
+++ trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-07-16 17:05:56 UTC (rev 1136)
@@ -122,6 +122,7 @@
private void initClassCache(){
+ // FIXME: redo method list
Class[] clazz = new Class[]{String.class};
classCache.put("getContext", clazz);
classCache.put("getMimeType", clazz);
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-07-16 00:36:42 UTC (rev 1135)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-07-16 17:05:56 UTC (rev 1136)
@@ -214,6 +214,13 @@
/**
+ * The set of application listener class names configured for this
+ * application, in the order they were encountered in the web.xml file.
+ */
+ protected EventListener applicationListenerInstances[] = new EventListener[0];
+
+
+ /**
* The set of instantiated application event listener objects</code>.
*/
protected Object applicationEventListenersObjects[] =
@@ -2010,7 +2017,7 @@
* @param listener Java class name of a listener class
*/
public void addApplicationListener(String listener) {
- String results[] =new String[applicationListeners.length + 1];
+ String results[] = new String[applicationListeners.length + 1];
for (int i = 0; i < applicationListeners.length; i++) {
if (listener.equals(applicationListeners[i])) {
log.info(sm.getString("standardContext.duplicateListener", listener));
@@ -2021,11 +2028,31 @@
results[applicationListeners.length] = listener;
applicationListeners = results;
fireContainerEvent("addApplicationListener", listener);
- // FIXME - add instance if already started?
}
/**
+ * Add a new Listener instance to the set of Listeners
+ * configured for this application.
+ *
+ * @param listener Java instance of a listener
+ */
+ public <T extends EventListener> void addApplicationListenerInstance(T listener) {
+ EventListener results[] = new EventListener[applicationListenerInstances.length + 1];
+ for (int i = 0; i < applicationListenerInstances.length; i++) {
+ if (listener.equals(applicationListenerInstances[i])) {
+ log.info(sm.getString("standardContext.duplicateListener", listener));
+ return;
+ }
+ results[i] = applicationListenerInstances[i];
+ }
+ results[applicationListenerInstances.length] = listener;
+ applicationListenerInstances = results;
+ fireContainerEvent("addApplicationListenerInstance", listener);
+ }
+
+
+ /**
* Add a new application parameter for this application.
*
* @param parameter The new application parameter
@@ -2798,6 +2825,16 @@
/**
+ * Return the set of JSP property groups.
+ */
+ public JspPropertyGroup[] findJspPropertyGroups() {
+ JspPropertyGroup results[] =
+ new JspPropertyGroup[jspPropertyGroups.size()];
+ return jspPropertyGroups.values().toArray(results);
+ }
+
+
+ /**
* FIXME: Fooling introspection ...
*/
public Context findMappingObject() {
@@ -3691,9 +3728,10 @@
// Instantiate the required listeners
String listeners[] = findApplicationListeners();
- EventListener results[] = new EventListener[listeners.length];
+ EventListener listenerInstances[] = applicationListenerInstances;
+ EventListener results[] = new EventListener[listeners.length + listenerInstances.length];
boolean ok = true;
- for (int i = 0; i < results.length; i++) {
+ for (int i = 0; i < listeners.length; i++) {
if (getLogger().isDebugEnabled())
getLogger().debug(" Configuring event listener class '" +
listeners[i] + "'");
@@ -3706,6 +3744,9 @@
ok = false;
}
}
+ for (int i = 0; i < listenerInstances.length; i++) {
+ results[i + listeners.length] = listenerInstances[i];
+ }
if (!ok) {
getLogger().error(sm.getString("standardContext.applicationSkipped"));
return (false);
15 years, 5 months
JBossWeb SVN: r1133 - trunk/java/org/apache/catalina/startup.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-07-10 12:24:33 -0400 (Fri, 10 Jul 2009)
New Revision: 1133
Modified:
trunk/java/org/apache/catalina/startup/WebOrderingRuleSet.java
Log:
- Fix root element.
Modified: trunk/java/org/apache/catalina/startup/WebOrderingRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/WebOrderingRuleSet.java 2009-07-09 17:09:05 UTC (rev 1132)
+++ trunk/java/org/apache/catalina/startup/WebOrderingRuleSet.java 2009-07-10 16:24:33 UTC (rev 1133)
@@ -90,17 +90,17 @@
*/
public void addRuleInstances(Digester digester) {
- digester.addObjectCreate(prefix + "web-app",
+ digester.addObjectCreate(prefix + "web-fragment",
"org.apache.catalina.deploy.WebOrdering");
- digester.addCallMethod(prefix + "web-app/name",
+ digester.addCallMethod(prefix + "web-fragment/name",
"setName", 0);
- digester.addCallMethod(prefix + "web-app/ordering/after/name",
+ digester.addCallMethod(prefix + "web-fragment/ordering/after/name",
"addAfter", 0);
- digester.addCallMethod(prefix + "web-app/ordering/before/name",
+ digester.addCallMethod(prefix + "web-fragment/ordering/before/name",
"addBefore", 0);
- digester.addRule(prefix + "web-app/ordering/after/others",
+ digester.addRule(prefix + "web-fragment/ordering/after/others",
new SetAfterOthersRule());
- digester.addRule(prefix + "web-app/ordering/before/others",
+ digester.addRule(prefix + "web-fragment/ordering/before/others",
new SetBeforeOthersRule());
}
15 years, 5 months
JBossWeb SVN: r1132 - sandbox/webapps/src.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-07-09 13:09:05 -0400 (Thu, 09 Jul 2009)
New Revision: 1132
Modified:
sandbox/webapps/src/MyCookies.java
Log:
Add a test for case 292473.
Modified: sandbox/webapps/src/MyCookies.java
===================================================================
--- sandbox/webapps/src/MyCookies.java 2009-07-09 16:02:35 UTC (rev 1131)
+++ sandbox/webapps/src/MyCookies.java 2009-07-09 17:09:05 UTC (rev 1132)
@@ -80,7 +80,7 @@
/*
* create the name/value pairs
*/
- Test[] mytest = new Test[11];
+ Test[] mytest = new Test[13];
StringBuffer buffer = new StringBuffer();
buffer.append("<xml><name>John Doe</name><age attribute=\"this breaks\">45</age></xml>");
mytest[0] = new Test("xmlCookie",buffer.toString());
@@ -95,8 +95,9 @@
mytest[8] = new Test("Quoted6","A");
mytest[9] = new Test("Quoted7","val'ue");
mytest[10] = new Test("Quoted8","I am \" testing...");
- mytest[10] = new Test("Quoted9","I am \r\n testing...");
-
+ mytest[11] = new Test("Quoted9","I am \r\n testing...");
+ // mytest[12] = new Test("Equal","P=I am = Equal\n...&A=46164");
+ mytest[12] = new Test("Equal","P=14662+26891+20253+28934+15744+22344+43641+13624+28974+15489+35353+47293+14662+26891+20253+28934+28596+27065+28648+22542&L=60766+6654+19186+43352+58684+61932+37440+23672&A=46164+56607+41861+51054&S=46164+56607+41861+51054&T=23922+55384+5601+51160+38643+36027+49212+16265+61873+55260+16665+53468&X=12795+26412+43746+37688&U=47207+55215+24609+16813+46164+56607+41861+51054&D=36080+20612+7827+5411+35188+54326+19636+46695+27748+646+37165+34626&C=11656+47389+63649+49622+46164+56607+41861+51054&");
Cookie[] cookies = request.getCookies();
if(cookies != null) {
for(int i=0;i<cookies.length;i++) {
@@ -104,6 +105,7 @@
out.println("Value=" + cookies[i].getValue() + "<br>");
out.println("Expected=" + GetVal(mytest, cookies[i].getName()) + "<br>");
}
+ out.println("<hr>");
}
/* create the cookies */
@@ -112,14 +114,14 @@
Cookie cookie = CreateCookie(mytest[i]);
response.addCookie(cookie);
} catch (Exception ex) {
- out.println("Cookie test: " + i + " Failed");
+ out.println("Cookie test: " + i + " Failed<br>");
}
}
Cookie cookie = new Cookie("commented", "commented cookie");
cookie.setComment("This is a comment");
response.addCookie(cookie);
- out.println("<P>");
+ out.println("<hr>");
out.println("<P>");
out.print("<form action=\"");
15 years, 5 months
JBossWeb SVN: r1131 - in trunk: java/org/apache/catalina/realm and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-07-09 12:02:35 -0400 (Thu, 09 Jul 2009)
New Revision: 1131
Modified:
trunk/java/org/apache/catalina/connector/LocalStrings.properties
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/realm/GenericPrincipal.java
trunk/java/org/apache/catalina/realm/JAASRealm.java
trunk/java/org/apache/catalina/realm/JNDIRealm.java
trunk/java/org/apache/catalina/session/LocalStrings.properties
trunk/java/org/apache/catalina/session/StandardSession.java
trunk/webapps/docs/changelog.xml
Log:
- Port: Add logout for JAAS login context.
- Port: Some JNDI realm stuff.
Modified: trunk/java/org/apache/catalina/connector/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/connector/LocalStrings.properties 2009-07-08 16:00:01 UTC (rev 1130)
+++ trunk/java/org/apache/catalina/connector/LocalStrings.properties 2009-07-09 16:02:35 UTC (rev 1131)
@@ -55,6 +55,7 @@
coyoteRequest.noAsync=The servlet or filters that are being used by this request do not support async operation
coyoteRequest.servletStack=Current Servlet stack for thread {0}
coyoteRequest.closed=Response has been closed already
+coyoteRequest.logoutfail=Exception logging out user
#
# MapperListener
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-07-08 16:00:01 UTC (rev 1130)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-07-09 16:02:35 UTC (rev 1131)
@@ -3061,6 +3061,7 @@
}
public void logout() throws ServletException {
+ Principal principal = userPrincipal;
userPrincipal = null;
authType = null;
Session session = getSessionInternal(false);
@@ -3068,6 +3069,14 @@
session.setPrincipal(null);
session.setAuthType(null);
}
+ if (principal instanceof GenericPrincipal) {
+ GenericPrincipal gp = (GenericPrincipal) principal;
+ try {
+ gp.logout();
+ } catch (Exception e) {
+ throw new ServletException(sm.getString("coyoteRequest.logoutfail"), e);
+ }
+ }
}
public DispatcherType getDispatcherType() {
Modified: trunk/java/org/apache/catalina/realm/GenericPrincipal.java
===================================================================
--- trunk/java/org/apache/catalina/realm/GenericPrincipal.java 2009-07-08 16:00:01 UTC (rev 1130)
+++ trunk/java/org/apache/catalina/realm/GenericPrincipal.java 2009-07-09 16:02:35 UTC (rev 1131)
@@ -22,6 +22,9 @@
import java.security.Principal;
import java.util.Arrays;
import java.util.List;
+
+import javax.security.auth.login.LoginContext;
+
import org.apache.catalina.Realm;
@@ -65,7 +68,7 @@
* @param roles List of roles (must be Strings) possessed by this user
*/
public GenericPrincipal(Realm realm, String name, String password,
- List roles) {
+ List<String> roles) {
this(realm, name, password, roles, null);
}
@@ -82,8 +85,27 @@
* getUserPrincipal call if not null; if null, this will be returned
*/
public GenericPrincipal(Realm realm, String name, String password,
- List roles, Principal userPrincipal) {
-
+ List<String> roles, Principal userPrincipal) {
+ this(realm, name, password, roles, userPrincipal, null);
+ }
+
+ /**
+ * Construct a new Principal, associated with the specified Realm, for the
+ * specified username and password, with the specified role names
+ * (as Strings).
+ *
+ * @param realm The Realm that owns this principal
+ * @param name The username of the user represented by this Principal
+ * @param password Credentials used to authenticate this user
+ * @param roles List of roles (must be Strings) possessed by this user
+ * @param userPrincipal - the principal to be returned from the request
+ * getUserPrincipal call if not null; if null, this will be returned
+ * @param loginContext - If provided, this will be used to log out the user
+ * at the appropriate time
+ */
+ public GenericPrincipal(Realm realm, String name, String password,
+ List<String> roles, Principal userPrincipal,
+ LoginContext loginContext) {
super();
this.realm = realm;
this.name = name;
@@ -95,6 +117,7 @@
if (this.roles.length > 0)
Arrays.sort(this.roles);
}
+ this.loginContext = loginContext;
}
@@ -160,6 +183,12 @@
}
+ /**
+ * The JAAS LoginContext, if any, used to authenticate this Principal.
+ * Kept so we can call logout().
+ */
+ protected LoginContext loginContext = null;
+
// --------------------------------------------------------- Public Methods
@@ -180,6 +209,23 @@
/**
+ * Calls logout, if necessary, on any associated JAASLoginContext. May in
+ * the future be extended to cover other logout requirements.
+ *
+ * @throws Exception If something goes wrong with the logout. Uses Exception
+ * to allow for future expansion of this method to cover
+ * other logout mechanisms that might throw a different
+ * exception to LoginContext
+ *
+ */
+ public void logout() throws Exception {
+ if (loginContext != null) {
+ loginContext.logout();
+ }
+ }
+
+
+ /**
* Return a String representation of this object, which exposes only
* information that should be public.
*/
Modified: trunk/java/org/apache/catalina/realm/JAASRealm.java
===================================================================
--- trunk/java/org/apache/catalina/realm/JAASRealm.java 2009-07-08 16:00:01 UTC (rev 1130)
+++ trunk/java/org/apache/catalina/realm/JAASRealm.java 2009-07-09 16:02:35 UTC (rev 1131)
@@ -426,7 +426,7 @@
log.debug(sm.getString("jaasRealm.loginContextCreated", username));
// Return the appropriate Principal for this authenticated Subject
- Principal principal = createPrincipal(username, subject);
+ Principal principal = createPrincipal(username, subject, loginContext);
if (principal == null) {
log.debug(sm.getString("jaasRealm.authenticateFailure", username));
return (null);
@@ -487,8 +487,11 @@
* roles, but only if their respective classes match one of the "role class" classes.
* If a user Principal cannot be constructed, return <code>null</code>.
* @param subject The <code>Subject</code> representing the logged-in user
+ * @param loginContext Associated with th Princpal so
+ * {@link LoginContext#logout()} can be called later
*/
- protected Principal createPrincipal(String username, Subject subject) {
+ protected Principal createPrincipal(String username, Subject subject,
+ LoginContext loginContext) {
// Prepare to scan the Principals for this Subject
List<String> roles = new ArrayList<String>();
@@ -535,7 +538,8 @@
}
// Return the resulting Principal for our authenticated user
- return new GenericPrincipal(this, username, null, roles, userPrincipal);
+ return new GenericPrincipal(this, username, null, roles, userPrincipal,
+ loginContext);
}
/**
Modified: trunk/java/org/apache/catalina/realm/JNDIRealm.java
===================================================================
--- trunk/java/org/apache/catalina/realm/JNDIRealm.java 2009-07-08 16:00:01 UTC (rev 1130)
+++ trunk/java/org/apache/catalina/realm/JNDIRealm.java 2009-07-09 16:02:35 UTC (rev 1131)
@@ -1420,10 +1420,10 @@
boolean validated = false;
if (hasMessageDigest()) {
- // iPlanet support if the values starts with {SHA1}
+ // Some directories prefix the password with the hash type
// The string is in a format compatible with Base64.encode not
// the Hex encoding of the parent class.
- if (password.startsWith("{SHA}")) {
+ if (password.startsWith("{MD5}") || password.startsWith("{SHA}")) {
/* sync since super.digest() does this same thing */
synchronized (this) {
password = password.substring(5);
Modified: trunk/java/org/apache/catalina/session/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/session/LocalStrings.properties 2009-07-08 16:00:01 UTC (rev 1130)
+++ trunk/java/org/apache/catalina/session/LocalStrings.properties 2009-07-09 16:02:35 UTC (rev 1131)
@@ -45,6 +45,7 @@
standardSession.getId.ise=getId: Session already invalidated
standardSession.getMaxInactiveInterval.ise=getMaxInactiveInterval: Session already invalidated
standardSession.getValueNames.ise=getValueNames: Session already invalidated
+standardSession.logoutfail=Exception logging out user when expiring session
standardSession.notSerializable=Cannot serialize session attribute {0} for session {1}
standardSession.removeAttribute.ise=removeAttribute: Session already invalidated
standardSession.sessionEvent=Session event listener threw exception
Modified: trunk/java/org/apache/catalina/session/StandardSession.java
===================================================================
--- trunk/java/org/apache/catalina/session/StandardSession.java 2009-07-08 16:00:01 UTC (rev 1130)
+++ trunk/java/org/apache/catalina/session/StandardSession.java 2009-07-09 16:02:35 UTC (rev 1131)
@@ -52,6 +52,7 @@
import org.apache.catalina.Session;
import org.apache.catalina.SessionEvent;
import org.apache.catalina.SessionListener;
+import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.StringManager;
@@ -727,6 +728,18 @@
fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
}
+ // Call the logout method
+ if (principal instanceof GenericPrincipal) {
+ GenericPrincipal gp = (GenericPrincipal) principal;
+ try {
+ gp.logout();
+ } catch (Exception e) {
+ manager.getContainer().getLogger().error(
+ sm.getString("standardSession.logoutfail"),
+ e);
+ }
+ }
+
// We have completed expire of this session
expiring = false;
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-07-08 16:00:01 UTC (rev 1130)
+++ trunk/webapps/docs/changelog.xml 2009-07-09 16:02:35 UTC (rev 1131)
@@ -114,6 +114,12 @@
<fix>
JDBC driver cleanup fix, using a hack to define the cleaner component in the webapp classloader. (markt)
</fix>
+ <fix>
+ <bug>39231</bug>: Call logout on the JAAS login context whenever possible. (markt)
+ </fix>
+ <fix>
+ <bug>37984</bug>: Strip {MD5} as well as {SHA} from digested passwords. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
15 years, 5 months
JBossWeb SVN: r1130 - in trunk: java/org/apache/catalina/filters and 4 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-07-08 12:00:01 -0400 (Wed, 08 Jul 2009)
New Revision: 1130
Added:
trunk/java/org/apache/catalina/filters/
trunk/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java
Removed:
trunk/java/org/apache/catalina/valves/WebdavFixValve.java
Modified:
trunk/java/org/apache/catalina/loader/WebappClassLoader.java
trunk/java/org/apache/juli/OneLineFormatter.java
trunk/webapps/docs/changelog.xml
Log:
- Port newer WebDAV workaround filter.
- Port JDBC leak fix.
Added: trunk/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
===================================================================
--- trunk/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java (rev 0)
+++ trunk/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java 2009-07-08 16:00:01 UTC (rev 1130)
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.filters;
+
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+
+/**
+ * Filter that explicitly sets the default character set for media subtypes of
+ * the "text" type to ISO-8859-1. RFC2616 explicitly states that browsers must
+ * use ISO-8859-1 in these circumstances. However, browsers may attempt to
+ * auto-detect the character set. This may be exploited by an attacker to
+ * perform an XSS attack. Internet Explorer has this behaviour by default. Other
+ * browsers have an option to enable it.
+ *
+ * This filter prevents the attack by explicitly setting a character set. Unless
+ * the provided character set is explicitly overridden by the user - in which
+ * case they deserve everything they get - the browser will adhere to an
+ * explicitly set character set, thus preventing the XSS attack.
+ */
+public class AddDefaultCharsetFilter implements Filter {
+
+ public void destroy() {
+ // NOOP
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+
+ // Wrap the response
+ if (response instanceof HttpServletResponse) {
+ ResponseWrapper wrapped =
+ new ResponseWrapper((HttpServletResponse)response);
+ chain.doFilter(request, wrapped);
+ } else {
+ chain.doFilter(request, response);
+ }
+ }
+
+ public void init(FilterConfig filterConfig) throws ServletException {
+ // NOOP
+ }
+
+ /**
+ * Wrapper that adds the default character set for text media types if no
+ * character set is specified.
+ */
+ public class ResponseWrapper extends HttpServletResponseWrapper {
+
+ @Override
+ public void setContentType(String ct) {
+
+ if (ct != null && ct.startsWith("text/") &&
+ ct.indexOf("charset=") < 0) {
+ // Use getCharacterEncoding() in case the charset has already
+ // been set by a separate call.
+ super.setContentType(ct + ";charset=" + getCharacterEncoding());
+ } else {
+ super.setContentType(ct);
+ }
+
+ }
+
+ public ResponseWrapper(HttpServletResponse response) {
+ super(response);
+ }
+
+ }
+}
Added: trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
===================================================================
--- trunk/java/org/apache/catalina/filters/WebdavFixFilter.java (rev 0)
+++ trunk/java/org/apache/catalina/filters/WebdavFixFilter.java 2009-07-08 16:00:01 UTC (rev 1130)
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.filters;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Filter that attempts to force MS WebDAV clients connecting on port 80 to use
+ * a WebDAV client that actually works. Other workarounds that might help
+ * include:
+ * <ul>
+ * <li>Specifying the port, even if it is port 80, when trying to connect.</li>
+ * <li>Cancelling the first authentication dialog box and then trying to
+ * reconnect.</li>
+ * </ul>
+ *
+ * Generally each different version of the MS client has a different set of
+ * problems.
+ * <p>
+ * TODO: Update this filter to recognise specific MS clients and apply the
+ * appropriate workarounds for that particular client
+ * <p>
+ * As a filter, this is configured in web.xml like any other Filter. You usually
+ * want to map this filter to whatever your WebDAV servlet is mapped to.
+ * <p>
+ * In addition to the issues fixed by this Filter, the following issues have
+ * also been observed that cannot be fixed by this filter. Where possible the
+ * filter will add an message to the logs.
+ * <p>
+ * XP x64 SP2 (MiniRedir Version 3790)
+ * <ul>
+ * <li>Only connects to port 80</li>
+ * <li>Unknown issue means it doesn't work</li>
+ * </ul>
+ */
+
+public class WebdavFixFilter implements Filter {
+
+ private static final String LOG_MESSAGE_PREAMBLE =
+ "WebdavFixFilter: Detected client problem: ";
+
+ /* Start string for all versions */
+ private static final String UA_MINIDIR_START =
+ "Microsoft-WebDAV-MiniRedir";
+ /* XP 32-bit SP3 */
+ private static final String UA_MINIDIR_5_1_2600 =
+ "Microsoft-WebDAV-MiniRedir/5.1.2600";
+
+ /* XP 64-bit SP2 */
+ private static final String UA_MINIDIR_5_2_3790 =
+ "Microsoft-WebDAV-MiniRedir/5.2.3790";
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+ /**
+ * Check for the broken MS WebDAV client and if detected issue a re-direct
+ * that hopefully will cause the non-broken client to be used.
+ */
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+ if (!(request instanceof HttpServletRequest) ||
+ !(response instanceof HttpServletResponse)) {
+ chain.doFilter(request, response);
+ return;
+ }
+ HttpServletRequest httpRequest = ((HttpServletRequest) request);
+ HttpServletResponse httpResponse = ((HttpServletResponse) response);
+ String ua = httpRequest.getHeader("User-Agent");
+
+ if (ua == null || ua.length() == 0 ||
+ !ua.startsWith(UA_MINIDIR_START)) {
+ // No UA or starts with non MS value
+ // Hope everything just works...
+ chain.doFilter(request, response);
+ } else if (ua.startsWith(UA_MINIDIR_5_1_2600)) {
+ // XP 32-bit SP3 - needs redirect with explicit port
+ httpResponse.sendRedirect(buildRedirect(httpRequest));
+ } else if (ua.startsWith(UA_MINIDIR_5_2_3790)) {
+ // XP 64-bit SP2
+ if (!"".equals(httpRequest.getContextPath())) {
+ log(request,
+ "XP-x64-SP2 clients only work with the root context");
+ }
+ // Namespace issue maybe
+ // see http://greenbytes.de/tech/webdav/webdav-redirector-list.html
+ log(request, "XP-x64-SP2 is known not to work with WebDAV Servlet");
+
+ chain.doFilter(request, response);
+ } else {
+ // Don't know which MS client it is - try the redirect with an
+ // explicit port in the hope that it moves the client to a different
+ // WebDAV implementation that works
+ httpResponse.sendRedirect(buildRedirect(httpRequest));
+ }
+ }
+
+ private String buildRedirect(HttpServletRequest request) {
+ StringBuffer location =
+ new StringBuffer(request.getRequestURL().length());
+ location.append(request.getScheme());
+ location.append("://");
+ location.append(request.getServerName());
+ location.append(':');
+ // If we include the port, even if it is 80, then MS clients will use
+ // a WebDAV client that works rather than the MiniRedir that has
+ // problems with BASIC authentication
+ location.append(request.getServerPort());
+ location.append(request.getRequestURI());
+ return location.toString();
+ }
+
+ private void log(ServletRequest request, String msg) {
+ StringBuilder builder = new StringBuilder(LOG_MESSAGE_PREAMBLE);
+ builder.append(msg);
+ request.getServletContext().log(builder.toString());
+ }
+}
Added: trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java
===================================================================
--- trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java (rev 0)
+++ trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java 2009-07-08 16:00:01 UTC (rev 1130)
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.loader;
+
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Enumeration;
+
+import org.apache.catalina.util.StringManager;
+
+/**
+ * This class is loaded by the {@link WebappClassLoader} to enable it to
+ * deregister JDBC drivers forgotten by the web application. There are some
+ * classloading hacks involved - see {@link WebappClassLoader#clearReferences()}
+ * for details - but the short version is do not just create a new instance of
+ * this class with the new keyword.
+ */
+public class JdbcLeakPrevention {
+
+ /**
+ * The logger for this class.
+ */
+ protected static org.jboss.logging.Logger log=
+ org.jboss.logging.Logger.getLogger( JdbcLeakPrevention.class );
+
+ /**
+ * The string manager for this package.
+ */
+ protected static final StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+ public void clearJdbcDriverRegistrations() {
+ // Unregister any JDBC drivers loaded by the class loader that loaded
+ // this class - ie the webapp class loader
+ Enumeration<Driver> drivers = DriverManager.getDrivers();
+ while (drivers.hasMoreElements()) {
+ Driver driver = drivers.nextElement();
+ try {
+ DriverManager.deregisterDriver(driver);
+ } catch (SQLException sqle) {
+ log.warn(sm.getString("jdbcLeakPrevention.jdbcRemoveFailed",
+ driver.toString()), sqle);
+ }
+ }
+
+ }
+}
Modified: trunk/java/org/apache/catalina/loader/WebappClassLoader.java
===================================================================
--- trunk/java/org/apache/catalina/loader/WebappClassLoader.java 2009-07-07 16:54:44 UTC (rev 1129)
+++ trunk/java/org/apache/catalina/loader/WebappClassLoader.java 2009-07-08 16:00:01 UTC (rev 1130)
@@ -65,9 +65,6 @@
import java.security.PermissionCollection;
import java.security.Policy;
import java.security.PrivilegedAction;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
@@ -1164,15 +1161,52 @@
*/
protected void clearReferences() {
- // Unregister any JDBC drivers loaded by this classloader
- Enumeration drivers = DriverManager.getDrivers();
- while (drivers.hasMoreElements()) {
- Driver driver = (Driver) drivers.nextElement();
- if (driver.getClass().getClassLoader() == this) {
+ /*
+ * Deregister any JDBC drivers registered by the webapp that the webapp
+ * forgot. This is made unnecessary complex because a) DriverManager
+ * checks the class loader of the calling class (it would be much easier
+ * if it checked the context class loader) b) using reflection would
+ * create a dependency on the DriverManager implementation which can,
+ * and has, changed.
+ *
+ * We can't just create an instance of JdbcLeakPrevention as it will be
+ * loaded by the common class loader (since it's .class file is in the
+ * $CATALINA_HOME/lib directory). This would fail DriverManager's check
+ * on the class loader of the calling class. So, we load the bytes via
+ * our parent class loader but define the class with this class loader
+ * so the JdbcLeakPrevention looks like a webapp class to the
+ * DriverManager.
+ *
+ * If only apps cleaned up after themselves...
+ */
+ InputStream is = getResourceAsStream(
+ "org/apache/catalina/loader/JdbcLeakPrevention.class");
+ // Cheat - we know roughly how big the class will be (~1K) but allow
+ // plenty room to grow
+ byte[] classBytes = new byte[4096];
+ int offset = 0;
+ try {
+ int read = is.read(classBytes, offset, 4096-offset);
+ while (read > -1) {
+ offset += read;
+ read = is.read(classBytes, offset, 4096-offset);
+ }
+ Class<?> lpClass =
+ defineClass("org.apache.catalina.loader.JdbcLeakPrevention",
+ classBytes, 0, offset);
+ Object obj = lpClass.newInstance();
+ obj.getClass().getMethod(
+ "clearJdbcDriverRegistrations").invoke(obj);
+ } catch (Exception e) {
+ // So many things to go wrong above...
+ log.warn(sm.getString("webappClassLoader.jdbcRemoveFailed"), e);
+ } finally {
+ if (is != null) {
try {
- DriverManager.deregisterDriver(driver);
- } catch (SQLException e) {
- log.warn("SQL driver deregistration failed", e);
+ is.close();
+ } catch (IOException ioe) {
+ log.warn(sm.getString(
+ "webappClassLoader.jdbcRemoveStreamError"), ioe);
}
}
}
Deleted: trunk/java/org/apache/catalina/valves/WebdavFixValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/WebdavFixValve.java 2009-07-07 16:54:44 UTC (rev 1129)
+++ trunk/java/org/apache/catalina/valves/WebdavFixValve.java 2009-07-08 16:00:01 UTC (rev 1130)
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.catalina.valves;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-
-import org.apache.catalina.valves.ValveBase;
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-
-/**
- * Valve that attempts to force MS WebDAV clients connecting on port 80 to use
- * a WebDAV client that actually works. Other workarounds that might help
- * include:
- * <ul>
- * <li>Specifing the port, even if it is port 80, when trying to connect.</li>
- * <li>Canceling the first authentication dialog box and then trying to
- * reconnect.</li>
- * </ul>
- * To use this valve add the following <code><Valve
- * className="org.apache.catalina.valves.MicrosoftWebdavFixValve" /></code>
- * to your <code>Engine</code>, <code>Host</code> or <code>Context</code> as
- * required. Normally, this valve would be used at the <code>Context</code>
- * level.
- *
- * @version $Revision: 420067 $, $Date: 2006-07-08 09:16:58 +0200 (sub, 08 srp 2006) $
- */
-
-public class WebdavFixValve
- extends ValveBase {
-
- /**
- * Check for the broken MS WebDAV client and if detected issue a re-direct
- * that hopefully will cause the non-broken client to be used.
- */
- public void invoke(Request request, Response response)
- throws IOException, ServletException {
-
- String ua = request.getHeader("User-Agent");
- if (ua != null && ua.contains("MiniRedir")) {
- response.sendRedirect(buildRedirect(request));
- } else {
- getNext().invoke(request, response);
- }
- }
-
- private String buildRedirect(Request request) {
- StringBuffer location =
- new StringBuffer(request.getRequestURL().length());
- location.append(request.getScheme());
- location.append("://");
- location.append(request.getHost().getName());
- location.append(':');
- // If we include the port, even if it is 80, then MS clients will use
- // a WebDAV client that works rather than the MiniRedir that has
- // problems with BASIC authentication
- location.append(request.getServerPort());
- location.append(request.getRequestURI());
- return location.toString();
- }
-}
Modified: trunk/java/org/apache/juli/OneLineFormatter.java
===================================================================
--- trunk/java/org/apache/juli/OneLineFormatter.java 2009-07-07 16:54:44 UTC (rev 1129)
+++ trunk/java/org/apache/juli/OneLineFormatter.java 2009-07-08 16:00:01 UTC (rev 1130)
@@ -47,7 +47,7 @@
private final SimpleDateFormat monthFormatter = new SimpleDateFormat("MM");
private final SimpleDateFormat yearFormatter = new SimpleDateFormat("yyyy");
private final SimpleDateFormat timeFormatter =
- new SimpleDateFormat("HH:mm:ss");
+ new SimpleDateFormat("HH:mm:ss.S");
private Date currentDate;
private String currentDateString;
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-07-07 16:54:44 UTC (rev 1129)
+++ trunk/webapps/docs/changelog.xml 2009-07-08 16:00:01 UTC (rev 1130)
@@ -111,6 +111,9 @@
<fix>
MIME types cleanup. (kkolinko)
</fix>
+ <fix>
+ JDBC driver cleanup fix, using a hack to define the cleaner component in the webapp classloader. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
15 years, 5 months
JBossWeb SVN: r1129 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-07-07 12:54:44 -0400 (Tue, 07 Jul 2009)
New Revision: 1129
Modified:
trunk/java/org/apache/jasper/compiler/Generator.java
trunk/java/org/apache/jasper/compiler/PageInfo.java
trunk/webapps/docs/changelog.xml
Log:
- Port getProperty fix.
Modified: trunk/java/org/apache/jasper/compiler/Generator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Generator.java 2009-06-24 07:22:30 UTC (rev 1128)
+++ trunk/java/org/apache/jasper/compiler/Generator.java 2009-07-07 16:54:44 UTC (rev 1129)
@@ -31,6 +31,7 @@
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import java.util.Vector;
import javax.el.MethodExpression;
@@ -87,6 +88,8 @@
private BeanRepository beanInfo;
+ private Set<String> varInfoNames;
+
private JspCompilationContext ctxt;
private boolean isPoolingEnabled;
@@ -1124,18 +1127,26 @@
+ ")_jspx_page_context.findAttribute("
+ "\""
+ name + "\"))." + methodName + "())));");
- } else {
- // The object could be a custom action with an associated
+ } else if (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.
out
.printil("out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString"
+ "(org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty"
- + "(_jspx_page_context.getAttribute(\""
+ + "(_jspx_page_context.findAttribute(\""
+ name
- + "\", PageContext.PAGE_SCOPE), \""
+ + "\"), \""
+ property
+ "\")));");
+ } else {
+ StringBuilder msg =
+ new StringBuilder("jsp:getProperty for bean with name '");
+ msg.append(name);
+ msg.append(
+ "'. Name was not previously introduced as per JSP.5.3");
+
+ throw new JasperException(msg.toString());
}
n.setEndJavaLine(out.getJavaLine());
@@ -1799,6 +1810,18 @@
// restore previous writer
out = outSave;
}
+
+ // Add the named objects to the list of 'introduced' names to enable
+ // a later test as per JSP.5.3
+ VariableInfo[] infos = n.getVariableInfos();
+ if (infos != null && infos.length > 0) {
+ for (int i = 0; i < infos.length; i++) {
+ VariableInfo info = infos[i];
+ if (info != null && info.getVarName() != null)
+ pageInfo.getVarInfoNames().add(info.getVarName());
+ }
+ }
+
}
private static final String SINGLE_QUOTE = "'";
@@ -3386,6 +3409,7 @@
isPoolingEnabled = false;
}
beanInfo = pageInfo.getBeanRepository();
+ varInfoNames = pageInfo.getVarInfoNames();
breakAtLF = ctxt.getOptions().getMappedFile();
if (isPoolingEnabled) {
tagHandlerPoolNames = new Vector();
Modified: trunk/java/org/apache/jasper/compiler/PageInfo.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/PageInfo.java 2009-06-24 07:22:30 UTC (rev 1128)
+++ trunk/java/org/apache/jasper/compiler/PageInfo.java 2009-07-07 16:54:44 UTC (rev 1129)
@@ -22,6 +22,7 @@
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
+import java.util.Set;
import java.util.Vector;
import javax.el.ExpressionFactory;
@@ -43,6 +44,7 @@
private Vector dependants;
private BeanRepository beanRepository;
+ private Set<String> varInfoNames;
private HashMap taglibsMap;
private HashMap jspPrefixMapper;
private HashMap xmlPrefixMapper;
@@ -709,4 +711,8 @@
public void setTrimDirectiveWhitespaces(boolean trimDirectiveWhitespaces) {
this.trimDirectiveWhitespaces = trimDirectiveWhitespaces;
}
+
+ public Set<String> getVarInfoNames() {
+ return varInfoNames;
+ }
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-06-24 07:22:30 UTC (rev 1128)
+++ trunk/webapps/docs/changelog.xml 2009-07-07 16:54:44 UTC (rev 1129)
@@ -143,6 +143,9 @@
<fix>
<bug>47318</bug>: Process include preludes and codas when processing directives and whole pages. (markt)
</fix>
+ <fix>
+ <bug>38797</bug>: Fix getProperty code to what it used to be in Tomcat 5.5.12. (markt)
+ </fix>
</changelog>
</subsection>
</section>
15 years, 5 months