JBossWeb SVN: r1181 - in trunk/java/javax/servlet: annotation and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-30 06:30:15 -0400 (Wed, 30 Sep 2009)
New Revision: 1181
Modified:
trunk/java/javax/servlet/AsyncContext.java
trunk/java/javax/servlet/ServletContainerInitializer.java
trunk/java/javax/servlet/ServletContext.java
trunk/java/javax/servlet/annotation/MultipartConfig.java
trunk/java/javax/servlet/http/HttpServlet.java
Log:
- Spec update.
Modified: trunk/java/javax/servlet/AsyncContext.java
===================================================================
--- trunk/java/javax/servlet/AsyncContext.java 2009-09-25 14:57:35 UTC (rev 1180)
+++ trunk/java/javax/servlet/AsyncContext.java 2009-09-30 10:30:15 UTC (rev 1181)
@@ -147,11 +147,12 @@
* to the servlet container.
*
* <p>If the asynchronous cycle was started with
- * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}
- * then the dispatch is to the URI of the request passed to startAsync.
- * If the asynchronous cycle was started with
- * {@link ServletRequest#startAsync()}, then the dispatch is to the
- * URI of the request when it was last dispatched by the container.
+ * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)},
+ * and the request passed is an instance of HttpServletRequest,
+ * then the dispatch is to the URI returned by
+ * {@link javax.servlet.http.HttpServletRequest#getRequestURI}.
+ * Otherwise, the dispatch is to the URI of the request when it was
+ * last dispatched by the container.
*
* <p>The following sequence illustrates how this will work:
* <code><pre>
Modified: trunk/java/javax/servlet/ServletContainerInitializer.java
===================================================================
--- trunk/java/javax/servlet/ServletContainerInitializer.java 2009-09-25 14:57:35 UTC (rev 1180)
+++ trunk/java/javax/servlet/ServletContainerInitializer.java 2009-09-30 10:30:15 UTC (rev 1181)
@@ -54,11 +54,29 @@
* by the annotation, the container must pass a <tt>null</tt> Set of classes
* to {@link #onStartup}.
*
+ * <p>When examining the classes of an application to
+ * see if they match any of the criteria specified by the HandlesTypes
+ * annotation of a ServletContainerInitializer, the container may run into
+ * classloading problems if any of the application's optional JAR
+ * files are missing. Because the container is not in a position to decide
+ * whether these types of classloading failures will prevent
+ * the application from working correctly, it must ignore them,
+ * while at the same time providing a configuration option that would
+ * log them.
+ *
* <p>Implementations of this interface may be declared by a JAR file
* resource located inside the <tt>META-INF/services</tt> directory and
* named for the fully qualified class name of this interface, and will be
* discovered using the runtime's service provider lookup mechanism.
*
+ * <p>When an application is deployed, the order in which
+ * ServletContainerInitializer implementations are discovered
+ * by the runtime's service lookup mechanism must follow the
+ * application's classloading delegation model.
+ * Any ServletContainerInitializer implementations declared in
+ * any of the application's web fragment JAR files that are excluded
+ * from absolute ordering must be ignored.
+ *
* @see javax.servlet.annotation.HandlesTypes
*
* @since Servlet 3.0
Modified: trunk/java/javax/servlet/ServletContext.java
===================================================================
--- trunk/java/javax/servlet/ServletContext.java 2009-09-25 14:57:35 UTC (rev 1180)
+++ trunk/java/javax/servlet/ServletContext.java 2009-09-30 10:30:15 UTC (rev 1181)
@@ -748,6 +748,11 @@
* it will be completed (by assigning the given <tt>className</tt> to it)
* and returned.
*
+ * <p>This method supports any annotations applicable to Servlets
+ * that may have been specified on the class with the given
+ * <tt>className</tt>, with the exception of
+ * {@link javax.servlet.annotation.WebServlet}, which is ignored.
+ *
* @param servletName the name of the servlet
* @param className the fully qualified class name of the servlet
*
@@ -823,6 +828,11 @@
* it will be completed (by assigning the name of the given
* <tt>servletClass</tt> to it) and returned.
*
+ * <p>This method supports any annotations applicable to Servlets
+ * that may have been specified on the given <tt>servletClass</tt>,
+ * with the exception of {@link javax.servlet.annotation.WebServlet},
+ * which is ignored.
+ *
* @param servletName the name of the servlet
* @param servletClass the class object from which the servlet will be
* instantiated
@@ -850,9 +860,6 @@
/**
* Instantiates the given Servlet class.
*
- * <p>This method must support all annotations applicable to Servlets
- * as defined by the Servlet specification.
- *
* <p>The returned Servlet instance may be further customized before it
* is registered with this ServletContext via a call to
* {@link #addServlet(String,Servlet)}.
@@ -860,6 +867,11 @@
* <p>The given Servlet class must define a zero argument constructor,
* which is used to instantiate it.
*
+ * <p>This method supports any annotations applicable to Servlets
+ * that may have been specified on the given <tt>clazz</tt>, with the
+ * exception of {@link javax.servlet.annotation.WebServlet}, which
+ * is ignored.
+ *
* @param clazz the Servlet class to instantiate
*
* @return the new Servlet instance
@@ -941,6 +953,11 @@
* it will be completed (by assigning the given <tt>className</tt> to it)
* and returned.
*
+ * <p>This method supports any annotations applicable to Filters
+ * that may have been specified on the class with the given
+ * <tt>className</tt>, with the exception of
+ * {@link javax.servlet.annotation.WebFilter}, which is ignored.
+ *
* @param filterName the name of the filter
* @param className the fully qualified class name of the filter
*
@@ -1013,6 +1030,11 @@
* it will be completed (by assigning the name of the given
* <tt>filterClass</tt> to it) and returned.
*
+ * <p>This method supports any annotations applicable to Filters
+ * that may have been specified on the given <tt>filterClass</tt>,
+ * with the exception of {@link javax.servlet.annotation.WebFilter},
+ * which is ignored.
+ *
* @param filterName the name of the filter
* @param filterClass the class object from which the filter will be
* instantiated
@@ -1040,9 +1062,6 @@
/**
* Instantiates the given Filter class.
*
- * <p>This method must support all annotations applicable to Filters
- * as defined by the Servlet specification.
- *
* <p>The returned Filter instance may be further customized before it
* is registered with this ServletContext via a call to
* {@link #addFilter(String,Filter)}.
@@ -1050,6 +1069,11 @@
* <p>The given Filter class must define a zero argument constructor,
* which is used to instantiate it.
*
+ * <p>This method supports any annotations applicable to Filters
+ * that may have been specified on the given <tt>clazz</tt>, with the
+ * exception of {@link javax.servlet.annotation.WebFilter}, which is
+ * ignored.
+ *
* @param clazz the Filter class to instantiate
*
* @return the new Filter instance
@@ -1245,6 +1269,11 @@
* then the new listener will be added to the end of the ordered list of
* listeners of that interface.
*
+ * <p>This method supports any annotations applicable to the above
+ * types of listeners that may have been specified on the class with the
+ * given <tt>className</tt>, with the exception of
+ * {@link javax.servlet.annotation.WebListener}, which is ignored.
+ *
* @param className the fully qualified class name of the listener
*
* @throws IllegalArgumentException if the class with the given name
@@ -1340,6 +1369,11 @@
* then the new listener will be added to the end of the ordered list
* of listeners of that interface.
*
+ * <p>This method supports any annotations applicable to the above
+ * types of listeners that may have been specified on the given
+ * <tt>listenerClass</tt>, with the exception of
+ * {@link javax.servlet.annotation.WebListener}, which is ignored.
+ *
* @param listenerClass the listener class to be instantiated
*
* @throws IllegalArgumentException if the given <tt>listenerClass</tt>
@@ -1373,9 +1407,6 @@
* <code>{@link javax.servlet.http.HttpSessionAttributeListener}</code>
* interfaces.
*
- * <p>This method must support all annotations applicable to the above
- * listener interfaces as defined by the Servlet specification.
- *
* <p>The returned EventListener instance may be further customized
* before it is registered with this ServletContext via a call to
* {@link #addListener(EventListener)}.
@@ -1383,6 +1414,11 @@
* <p>The given EventListener class must define a zero argument
* constructor, which is used to instantiate it.
*
+ * <p>This method supports any annotations applicable to the above
+ * types of listeners that may have been specified on the given
+ * <tt>clazz</tt>, with the exception of
+ * {@link javax.servlet.annotation.WebListener}, which is ignored.
+ *
* @param clazz the EventListener class to instantiate
*
* @return the new EventListener instance
Modified: trunk/java/javax/servlet/annotation/MultipartConfig.java
===================================================================
--- trunk/java/javax/servlet/annotation/MultipartConfig.java 2009-09-25 14:57:35 UTC (rev 1180)
+++ trunk/java/javax/servlet/annotation/MultipartConfig.java 2009-09-30 10:30:15 UTC (rev 1181)
@@ -41,6 +41,18 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+/**
+ * Annotation that may be specified on a {@link javax.servlet.Servlet}
+ * class, indicating that instances of the <tt>Servlet</tt> expect requests
+ * that conform to the <tt>multipart/form-data</tt> MIME type.
+ *
+ * <p>Servlets annotated with <tt>MultipartConfig</tt> may retrieve the
+ * {@link javax.servlet.http.Part} components of a given
+ * <tt>multipart/form-data</tt> request by calling
+ * {@link javax.servlet.http.HttpServletRequest#getPart getPart} or
+ * {@link javax.servlet.http.HttpServletRequest#getParts getParts}.
+ */
+
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MultipartConfig {
Modified: trunk/java/javax/servlet/http/HttpServlet.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServlet.java 2009-09-25 14:57:35 UTC (rev 1180)
+++ trunk/java/javax/servlet/http/HttpServlet.java 2009-09-30 10:30:15 UTC (rev 1181)
@@ -734,7 +734,7 @@
doGet(req, resp);
} else {
long ifModifiedSince = req.getDateHeader(HEADER_IFMODSINCE);
- if (ifModifiedSince < (lastModified / 1000 * 1000)) {
+ if (ifModifiedSince < lastModified) {
// If the servlet mod time is later, call doGet()
// Round down to the nearest second for a proper compare
// A ifModifiedSince of -1 will always be less
15 years, 3 months
JBossWeb SVN: r1180 - branches/2.1.x/java/org/apache/tomcat/jni.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-09-25 10:57:35 -0400 (Fri, 25 Sep 2009)
New Revision: 1180
Modified:
branches/2.1.x/java/org/apache/tomcat/jni/LibraryLoader.java
Log:
Add bin/native in the logic.
Modified: branches/2.1.x/java/org/apache/tomcat/jni/LibraryLoader.java
===================================================================
--- branches/2.1.x/java/org/apache/tomcat/jni/LibraryLoader.java 2009-09-25 12:53:00 UTC (rev 1179)
+++ branches/2.1.x/java/org/apache/tomcat/jni/LibraryLoader.java 2009-09-25 14:57:35 UTC (rev 1180)
@@ -140,15 +140,19 @@
dlibName = dlibName.substring(1);
optional = true;
}
- String fullPath = metaPath + path +
+ String fullPath = metaPath + File.separator + path +
File.separator + dlibName;
+ meta = new File(fullPath);
+ if (!meta.exists()) {
+ fullPath = metaPath + File.separator + dlibName;
+ }
try {
Runtime.getRuntime().load(fullPath);
}
catch (Throwable d) {
if (!optional) {
- java.io.File fd = new java.io.File(fullPath);
- if (fd.exists()) {
+ meta = new File(fullPath);
+ if (meta.exists()) {
throw new UnsatisfiedLinkError(" Error: " + d.getMessage() + " " );
} else {
throw new UnsatisfiedLinkError(" Can't find: " + fullPath + " ");
15 years, 3 months
JBossWeb SVN: r1179 - branches/2.1.x/java/org/apache/tomcat/jni.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-09-25 08:53:00 -0400 (Fri, 25 Sep 2009)
New Revision: 1179
Modified:
branches/2.1.x/java/org/apache/tomcat/jni/LibraryLoader.java
Log:
Also try bin/native...
Modified: branches/2.1.x/java/org/apache/tomcat/jni/LibraryLoader.java
===================================================================
--- branches/2.1.x/java/org/apache/tomcat/jni/LibraryLoader.java 2009-09-24 17:43:42 UTC (rev 1178)
+++ branches/2.1.x/java/org/apache/tomcat/jni/LibraryLoader.java 2009-09-25 12:53:00 UTC (rev 1179)
@@ -118,6 +118,10 @@
*/
metaPath = basePath + "bin" + File.separator +
getDefaultMetaPath();
+ meta = new File(metaPath);
+ if (!meta.exists()) {
+ metaPath = basePath + "bin" + File.separator + "native";
+ }
}
try {
InputStream is = LibraryLoader.class.getResourceAsStream
15 years, 3 months
JBossWeb SVN: r1178 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-24 13:43:42 -0400 (Thu, 24 Sep 2009)
New Revision: 1178
Added:
tags/JBOSSWEB_3_0_0_ALPHA5/
Log:
- Fix important taglib issue (bad attributes parsing), affecting JSF in
particular.
Copied: tags/JBOSSWEB_3_0_0_ALPHA5 (from rev 1177, trunk)
15 years, 3 months
JBossWeb SVN: r1177 - trunk/java/org/apache/jasper/compiler.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-24 06:23:45 -0400 (Thu, 24 Sep 2009)
New Revision: 1177
Modified:
trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
Log:
- Fix handling of deferred value and method.
Modified: trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java 2009-09-22 13:35:50 UTC (rev 1176)
+++ trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java 2009-09-24 10:23:45 UTC (rev 1177)
@@ -255,8 +255,8 @@
String methodSignature = attributeInfo.getMethodSignature();
boolean rtexprvalue = JspUtil.booleanValue(attributeInfo.getReqTime());
boolean fragment = JspUtil.booleanValue(attributeInfo.getFragment());
- boolean deferredValue = JspUtil.booleanValue(attributeInfo.getDeferredValue());
- boolean deferredMethod = JspUtil.booleanValue(attributeInfo.getDeferredMethod());
+ boolean deferredValue = attributeInfo.getDeferredValue() != null;
+ boolean deferredMethod = attributeInfo.getDeferredMethod() != null;
boolean required = JspUtil.booleanValue(attributeInfo.getRequired());
if (type != null) {
15 years, 3 months
JBossWeb SVN: r1176 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-22 09:35:50 -0400 (Tue, 22 Sep 2009)
New Revision: 1176
Added:
tags/JBOSSWEB_3_0_0_ALPHA4/
Log:
- New alpha 4 tag.
Copied: tags/JBOSSWEB_3_0_0_ALPHA4 (from rev 1175, trunk)
15 years, 3 months
JBossWeb SVN: r1175 - trunk/java/org/apache/catalina/startup.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-22 09:28:07 -0400 (Tue, 22 Sep 2009)
New Revision: 1175
Modified:
trunk/java/org/apache/catalina/startup/WebAnnotationSet.java
Log:
- Comment out the security annotations processing.
Modified: trunk/java/org/apache/catalina/startup/WebAnnotationSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/WebAnnotationSet.java 2009-09-22 13:25:03 UTC (rev 1174)
+++ trunk/java/org/apache/catalina/startup/WebAnnotationSet.java 2009-09-22 13:28:07 UTC (rev 1175)
@@ -19,27 +19,13 @@
package org.apache.catalina.startup;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-
import javax.annotation.Resource;
import javax.annotation.Resources;
import javax.annotation.security.DeclareRoles;
-import javax.annotation.security.DenyAll;
-import javax.annotation.security.PermitAll;
-import javax.annotation.security.RolesAllowed;
-import javax.annotation.security.RunAs;
-import javax.annotation.security.TransportProtected;
import javax.servlet.annotation.MultipartConfig;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
-import org.apache.catalina.Globals;
import org.apache.catalina.core.StandardWrapper;
import org.apache.catalina.deploy.ContextEnvironment;
import org.apache.catalina.deploy.ContextResource;
@@ -48,8 +34,6 @@
import org.apache.catalina.deploy.FilterDef;
import org.apache.catalina.deploy.MessageDestinationRef;
import org.apache.catalina.deploy.Multipart;
-import org.apache.catalina.deploy.SecurityCollection;
-import org.apache.catalina.deploy.SecurityConstraint;
/**
* <p><strong>AnnotationSet</strong> for processing the annotations of the web application
@@ -148,6 +132,7 @@
// Process JSR 250 access control annotations
// Process PermitAll, TransportProtected and RolesAllowed on the class
+ /*
boolean classPA = false, classTP = false;
String[] classRA = null;
ArrayList<String> methodOmissions = new ArrayList<String>();
@@ -278,7 +263,7 @@
constraint.addCollection(collection);
context.addConstraint(constraint);
}
-
+ */
}
}
15 years, 3 months
JBossWeb SVN: r1174 - trunk.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-09-22 09:25:03 -0400 (Tue, 22 Sep 2009)
New Revision: 1174
Modified:
trunk/build.xml
Log:
- Remove the packaging hack, as the annotation will no longer be used.
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2009-09-22 13:17:34 UTC (rev 1173)
+++ trunk/build.xml 2009-09-22 13:25:03 UTC (rev 1174)
@@ -583,7 +583,6 @@
<jar jarfile="${tomcat.jars}/jbossweb.jar" index="true">
<fileset dir="${tomcat.classes}">
<!-- Temp EE class -->
- <include name="javax/annotation/security/TransportProtected.class" />
<include name="org/apache/catalina/**" />
<exclude name="org/apache/catalina/startup/catalina.properties" />
<include name="org/apache/naming/**" />
15 years, 3 months
JBossWeb SVN: r1173 - 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-09-22 09:17:34 -0400 (Tue, 22 Sep 2009)
New Revision: 1173
Modified:
trunk/java/javax/servlet/ServletContext.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/LocalStrings.properties
trunk/java/org/apache/catalina/core/StandardContext.java
Log:
- Implementation for the restricted listeners.
Modified: trunk/java/javax/servlet/ServletContext.java
===================================================================
--- trunk/java/javax/servlet/ServletContext.java 2009-09-22 05:04:35 UTC (rev 1172)
+++ trunk/java/javax/servlet/ServletContext.java 2009-09-22 13:17:34 UTC (rev 1173)
@@ -864,8 +864,8 @@
*
* @return the new Servlet instance
*
- * @throws ServletException if an error occurs during the instantiation
- * of, or resource injection into the new Servlet
+ * @throws ServletException if the given <tt>clazz</tt> fails to be
+ * instantiated
*
* @throws UnsupportedOperationException if this ServletContext was
* passed to the {@link ServletContextListener#contextInitialized} method
@@ -1054,8 +1054,8 @@
*
* @return the new Filter instance
*
- * @throws ServletException if an error occurs during the instantiation
- * of, or resource injection into the new Filter
+ * @throws ServletException if the given <tt>clazz</tt> fails to be
+ * instantiated
*
* @throws UnsupportedOperationException if this ServletContext was
* passed to the {@link ServletContextListener#contextInitialized} method
@@ -1387,8 +1387,8 @@
*
* @return the new EventListener instance
*
- * @throws ServletException if an error occurs during the instantiation
- * of, or resource injection into the new EventListener
+ * @throws ServletException if the given <tt>clazz</tt> fails to be
+ * instantiated
*
* @throws UnsupportedOperationException if this ServletContext was
* passed to the {@link ServletContextListener#contextInitialized} method
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-09-22 05:04:35 UTC (rev 1172)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-09-22 13:17:34 UTC (rev 1173)
@@ -188,6 +188,12 @@
private ThreadLocal<DispatchData> dispatchData =
new ThreadLocal<DispatchData>();
+
+ /**
+ * The restricted flag.
+ */
+ private boolean restricted = false;
+
// --------------------------------------------------------- Public Methods
@@ -204,6 +210,16 @@
}
+ public boolean isRestricted() {
+ return restricted;
+ }
+
+
+ public void setRestricted(boolean restricted) {
+ this.restricted = restricted;
+ }
+
+
// ------------------------------------------------- ServletContext Methods
@@ -847,7 +863,9 @@
public FilterRegistration.Dynamic addFilter(String filterName, String className)
throws IllegalArgumentException, IllegalStateException {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
if (context.isInitialized()) {
throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
@@ -863,7 +881,9 @@
public FilterRegistration.Dynamic addFilter(String filterName, Filter filter) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
if (context.isInitialized()) {
throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
@@ -881,14 +901,18 @@
public FilterRegistration.Dynamic addFilter(String filterName,
Class<? extends Filter> filterClass) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
return addFilter(filterName, filterClass.getName());
}
public ServletRegistration.Dynamic addServlet(String servletName, String className)
throws IllegalArgumentException, IllegalStateException {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
if (context.isInitialized()) {
throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
@@ -905,13 +929,17 @@
public ServletRegistration.Dynamic addServlet(String servletName,
Class<? extends Servlet> clazz) throws IllegalArgumentException,
IllegalStateException {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
return addServlet(servletName, clazz.getName());
}
public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
if (context.isInitialized()) {
throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
@@ -927,7 +955,9 @@
public FilterRegistration getFilterRegistration(String filterName) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
ApplicationFilterConfig filterConfig = context.findApplicationFilterConfig(filterName);
if (filterConfig == null) {
FilterDef filterDef = context.findFilterDef(filterName);
@@ -943,7 +973,9 @@
public ServletRegistration getServletRegistration(String servletName) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
Wrapper wrapper = (Wrapper) context.findChild(servletName);
if (wrapper != null) {
return wrapper.getFacade();
@@ -954,7 +986,9 @@
public Map<String, FilterRegistration> getFilterRegistrations() {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
HashMap<String, FilterRegistration> result =
new HashMap<String, FilterRegistration>();
ApplicationFilterConfig[] filterConfigs = context.findApplicationFilterConfigs();
@@ -966,7 +1000,9 @@
public Map<String, ServletRegistration> getServletRegistrations() {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
HashMap<String, ServletRegistration> result =
new HashMap<String, ServletRegistration>();
Container[] wrappers = context.findChildren();
@@ -979,25 +1015,33 @@
public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
return context.getDefaultSessionTrackingModes();
}
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
return context.getSessionTrackingModes();
}
public SessionCookieConfig getSessionCookieConfig() {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
return context.getSessionCookie();
}
public <T extends Filter> T createFilter(Class<T> c)
throws ServletException {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
try {
return (T) context.getInstanceManager().newInstance(c);
} catch (Throwable e) {
@@ -1009,7 +1053,9 @@
public <T extends Servlet> T createServlet(Class<T> c)
throws ServletException {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
try {
return (T) context.getInstanceManager().newInstance(c);
} catch (Throwable e) {
@@ -1020,7 +1066,9 @@
public boolean setInitParameter(String name, String value) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
mergeParameters();
if (parameters.get(name) != null) {
return false;
@@ -1039,7 +1087,9 @@
* requested
*/
public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
if (context.getAvailable()) {
throw new IllegalStateException(
sm.getString("applicationContext.setSessionTracking.ise",
@@ -1059,7 +1109,9 @@
public void addListener(String className) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
if (context.isInitialized()) {
throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
@@ -1069,7 +1121,9 @@
public <T extends EventListener> void addListener(T listener) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
if (context.isInitialized()) {
throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
@@ -1079,7 +1133,9 @@
public void addListener(Class<? extends EventListener> listenerClass) {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
if (context.isInitialized()) {
throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
@@ -1097,7 +1153,9 @@
public <T extends EventListener> T createListener(Class<T> clazz)
throws ServletException {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
if (context.isInitialized()) {
throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
@@ -1114,13 +1172,17 @@
public ClassLoader getClassLoader() {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
return context.getLoader().getClassLoader();
}
public JspConfigDescriptor getJspConfigDescriptor() {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
ArrayList<TaglibDescriptor> taglibDescriptors = new ArrayList<TaglibDescriptor>();
String[] taglibURIs = context.findTaglibs();
for (int i = 0; i < taglibURIs.length; i++) {
@@ -1140,13 +1202,17 @@
public int getEffectiveMajorVersion() {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
return context.getVersionMajor();
}
public int getEffectiveMinorVersion() {
- // FIXME: restricted method
+ if (restricted) {
+ throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
+ }
return context.getVersionMinor();
}
Modified: trunk/java/org/apache/catalina/core/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/core/LocalStrings.properties 2009-09-22 05:04:35 UTC (rev 1172)
+++ trunk/java/org/apache/catalina/core/LocalStrings.properties 2009-09-22 13:17:34 UTC (rev 1173)
@@ -14,6 +14,7 @@
# limitations under the License.
applicationContext.alreadyInitialized=Context {0} is already initialized.
+applicationContext.restricted=Listener that attempted to call this method is restricted.
applicationContext.attributeEvent=Exception thrown by attributes event listener
applicationContext.create=Error creating instance
applicationContext.mapping.error=Error during mapping
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-09-22 05:04:35 UTC (rev 1172)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-09-22 13:17:34 UTC (rev 1173)
@@ -218,6 +218,14 @@
/**
* The set of application listener class names configured for this
+ * application that have been added from TLDs, and have a limited access to
+ * the servlet context.
+ */
+ protected HashSet<String> restrictedApplicationListeners = new HashSet<String>();
+
+
+ /**
+ * 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];
@@ -2062,15 +2070,41 @@
* @param listener Java class name of a listener class
*/
public void addApplicationListener(String listener) {
+ addApplicationListener(listener, false);
+ }
+
+
+ /**
+ * Add a new Listener class name to the set of Listeners
+ * configured for this application.
+ *
+ * @param listener Java class name of a listener class
+ */
+ protected void addApplicationListener(String listener, boolean restricted) {
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));
+ if (!restricted && restrictedApplicationListeners.contains(listener)) {
+ restrictedApplicationListeners.remove(listener);
+ }
return;
}
results[i] = applicationListeners[i];
}
results[applicationListeners.length] = listener;
+ if (restricted && !restrictedApplicationListeners.contains(listener)) {
+ boolean found = false;
+ for (String check : applicationListeners) {
+ if (check.equals(listener)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ restrictedApplicationListeners.add(listener);
+ }
+ }
applicationListeners = results;
fireContainerEvent("addApplicationListener", listener);
}
@@ -2418,9 +2452,8 @@
// Add listeners specified by the taglib
String[] listeners = tagLibraryInfo.getListeners();
for (int i = 0; i < listeners.length; i++) {
- addApplicationListener(listeners[i]);
+ addApplicationListener(listeners[i], true);
}
- //System.out.println("Add TLD for URI: " + tagLibraryInfo.getUri() + " " + tagLibraryInfo);
jspTagLibraries.put(tagLibraryInfo.getUri(), tagLibraryInfo);
}
@@ -2432,7 +2465,6 @@
* @param tagLibrayInfo the tag library info that will be added
*/
public void addJspTagLibrary(String uri, TagLibraryInfo tagLibraryInfo) {
- //System.out.println("Add TLD for implicit URI: " + uri + " " + tagLibraryInfo);
jspTagLibraries.put(uri, tagLibraryInfo);
}
@@ -3834,6 +3866,7 @@
ServletContextListener listener =
(ServletContextListener) instances[i];
try {
+ context.setRestricted(isRestricted(listener));
fireContainerEvent("beforeContextInitialized", listener);
listener.contextInitialized(event);
fireContainerEvent("afterContextInitialized", listener);
@@ -3843,6 +3876,8 @@
(sm.getString("standardContext.listenerStart",
instances[i].getClass().getName()), t);
ok = false;
+ } finally {
+ context.setRestricted(false);
}
}
return (ok);
@@ -4651,6 +4686,14 @@
/**
+ * Is the specified listener restricted ?
+ */
+ protected boolean isRestricted(Object listener) {
+ return restrictedApplicationListeners.contains(listener.getClass().getName());
+ }
+
+
+ /**
* Are we processing a version 2.2 deployment descriptor?
*/
protected boolean isServlet22() {
15 years, 3 months
JBossWeb SVN: r1172 - branches.
by jbossweb-commits@lists.jboss.org
Author: vicky.kak(a)jboss.com
Date: 2009-09-22 01:04:35 -0400 (Tue, 22 Sep 2009)
New Revision: 1172
Added:
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-2841/
Log:
creating one-off patch for JBPAPP-2841
Copied: branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-2841 (from rev 1171, tags/JBOSSWEB_2_0_0_GA_CP08)
15 years, 3 months