Author: remy.maucherat(a)jboss.com
Date: 2009-05-08 11:02:57 -0400 (Fri, 08 May 2009)
New Revision: 1044
Modified:
trunk/java/javax/servlet/FilterRegistration.java
trunk/java/javax/servlet/Registration.java
trunk/java/javax/servlet/ServletContext.java
trunk/java/javax/servlet/ServletContextAttributeListener.java
trunk/java/javax/servlet/ServletContextListener.java
trunk/java/javax/servlet/ServletRegistration.java
trunk/java/javax/servlet/ServletRequest.java
trunk/java/javax/servlet/ServletRequestAttributeListener.java
trunk/java/javax/servlet/ServletRequestListener.java
trunk/java/javax/servlet/annotation/WebListener.java
trunk/java/javax/servlet/http/HttpSessionAttributeListener.java
trunk/java/javax/servlet/http/HttpSessionListener.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
trunk/java/org/apache/catalina/core/ApplicationFilterConfigFacade.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
trunk/java/org/apache/jasper/servlet/JspCServletContext.java
Log:
- Update to new Servlet API snapshot.
Modified: trunk/java/javax/servlet/FilterRegistration.java
===================================================================
--- trunk/java/javax/servlet/FilterRegistration.java 2009-05-07 17:10:59 UTC (rev 1043)
+++ trunk/java/javax/servlet/FilterRegistration.java 2009-05-08 15:02:57 UTC (rev 1044)
@@ -37,6 +37,7 @@
package javax.servlet;
import java.util.EnumSet;
+import java.util.Set;
/**
* Interface through which a {@link Filter} may be further configured.
@@ -75,6 +76,15 @@
String... servletNames);
/**
+ * Gets an Iterable over the currently available servlet name mappings
+ * of the Filter represented by this FilterRegistration.
+ *
+ * @return Iterable over the currently available servlet name
+ * mappings of the Filter represented by this FilterRegistration.
+ */
+ public Iterable<String> getServletNameMappings();
+
+ /**
* Adds a filter mapping with the given url patterns and dispatcher
* types for the Filter represented by this FilterRegistration.
*
@@ -104,6 +114,15 @@
String... urlPatterns);
/**
+ * Gets an Iterable over the currently available URL pattern mappings
+ * of the Filter represented by this FilterRegistration.
+ *
+ * @return Iterable over the currently available URL pattern
+ * mappings of the Filter represented by this FilterRegistration.
+ */
+ public Iterable<String> getUrlPatternMappings();
+
+ /**
* Interface through which a {@link Filter} registered via one of the
* <tt>addFilter</tt> methods on {@link ServletContext} may be further
* configured.
Modified: trunk/java/javax/servlet/Registration.java
===================================================================
--- trunk/java/javax/servlet/Registration.java 2009-05-07 17:10:59 UTC (rev 1043)
+++ trunk/java/javax/servlet/Registration.java 2009-05-08 15:02:57 UTC (rev 1044)
@@ -48,6 +48,24 @@
public interface Registration {
/**
+ * Gets the name of the Servlet or Filter that is represented by this
+ * Registration.
+ *
+ * @return the name of the Servlet or Filter that is represented by this
+ * Registration
+ */
+ public String getName();
+
+ /**
+ * Gets the fully qualified class name of the Servlet or Filter that
+ * is represented by this Registration.
+ *
+ * @return the fully qualified class name of the Servlet or Filter
+ * that is represented by this Registration
+ */
+ public String getClassName();
+
+ /**
* Sets the initialization parameter with the given name and value
* on the Servlet or Filter that is represented by this Registration.
*
@@ -66,6 +84,20 @@
public boolean setInitParameter(String name, String value);
/**
+ * Gets the value of the initialization parameter with the given name
+ * that will be used to initialize the Servlet or Filter represented
+ * by this Registration object.
+ *
+ * @param name the name of the initialization parameter whose value is
+ * requested
+ *
+ * @return the value of the initialization parameter with the given
+ * name, or <tt>null</tt> if no initialization parameter with the given
+ * name exists
+ */
+ public String getInitParameter(String name);
+
+ /**
* Sets the given initialization parameters on the Servlet or Filter
* that is represented by this Registration.
*
@@ -92,6 +124,18 @@
public Set<String> setInitParameters(Map<String, String>
initParameters);
/**
+ * Gets an immutable (and possibly empty) Map containing the
+ * currently available initialization parameters that will be used to
+ * initialize the Servlet or Filter represented by this Registration
+ * object.
+ *
+ * @return Map containing the currently available initialization
+ * parameters that will be used to initialize the Servlet or Filter
+ * represented by this Registration object
+ */
+ public Map<String, String> getInitParameters();
+
+ /**
* Interface through which a {@link Servlet} or {@link Filter} registered
* via one of the <tt>addServlet</tt> or <tt>addFilter</tt>
methods,
* respectively, on {@link ServletContext} may be further configured.
Modified: trunk/java/javax/servlet/ServletContext.java
===================================================================
--- trunk/java/javax/servlet/ServletContext.java 2009-05-07 17:10:59 UTC (rev 1043)
+++ trunk/java/javax/servlet/ServletContext.java 2009-05-08 15:02:57 UTC (rev 1044)
@@ -773,10 +773,28 @@
*
* @since Servlet 3.0
*/
- public ServletRegistration findServletRegistration(String servletName);
+ public ServletRegistration getServletRegistration(String servletName);
/**
+ * Gets an immutable (and possibly empty) Map of the ServletRegistration
+ * objects (keyed by servlet name) corresponding to all servlets
+ * registered with this ServletContext.
+ *
+ * <p>The returned Map includes the ServletRegistration objects
+ * corresponding to all declared and annotated servlets, as well as the
+ * ServletRegistration objects corresponding to all servlets that have
+ * been added via one of the <tt>addServlet</tt> methods.
+ *
+ * @return Map of the ServletRegistration objects corresponding
+ * to all servlets currently registered with this ServletContext
+ *
+ * @since Servlet 3.0
+ */
+ public Map<String, ServletRegistration> getServletRegistrations();
+
+
+ /**
* Adds the filter with the given name and class name to this servlet
* context.
*
@@ -882,10 +900,28 @@
*
* @since Servlet 3.0
*/
- public FilterRegistration findFilterRegistration(String filterName);
+ public FilterRegistration getFilterRegistration(String filterName);
/**
+ * Gets an immutable (and possibly empty) Map of the FilterRegistration
+ * objects (keyed by filter name) corresponding to all filters
+ * registered with this ServletContext.
+ *
+ * <p>The returned Map includes the FilterRegistration objects
+ * corresponding to all declared and annotated filters, as well as the
+ * FilterRegistration objects corresponding to all filters that have
+ * been added via one of the <tt>addFilter</tt> methods.
+ *
+ * @return Map of the FilterRegistration objects corresponding
+ * to all filters currently registered with this ServletContext
+ *
+ * @since Servlet 3.0
+ */
+ public Map<String, FilterRegistration> getFilterRegistrations();
+
+
+ /**
* Gets the {@link SessionCookieConfig} object through which various
* properties of the session tracking cookies created on behalf of this
* <tt>ServletContext</tt> may be configured.
Modified: trunk/java/javax/servlet/ServletContextAttributeListener.java
===================================================================
--- trunk/java/javax/servlet/ServletContextAttributeListener.java 2009-05-07 17:10:59 UTC
(rev 1043)
+++ trunk/java/javax/servlet/ServletContextAttributeListener.java 2009-05-08 15:02:57 UTC
(rev 1044)
@@ -56,20 +56,50 @@
import java.util.EventListener;
- /** Implementations of this interface receive notifications of
- ** changes to the attribute list on the servlet context of a web application.
- * To receive notification events, the implementation class
- * must be configured in the deployment descriptor for the web application.
- * @see ServletContextAttributeEvent
- * @since Servlet 2.3
- */
+/**
+ * Interface for receiving notification events about ServletContext
+ * attribute changes.
+ *
+ * <p>In order to receive these notification events, the implementation
+ * class must be either declared in the deployment descriptor of the web
+ * application or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
+ *
+ * @see ServletContextAttributeEvent
+ *
+ * @since Servlet 2.3
+ */
public interface ServletContextAttributeListener extends EventListener {
- /** Notification that a new attribute was added to the servlet context. Called after the
attribute is added.*/
-public void attributeAdded(ServletContextAttributeEvent scab);
- /** Notification that an existing attribute has been removed from the servlet context.
Called after the attribute is removed.*/
-public void attributeRemoved(ServletContextAttributeEvent scab);
- /** Notification that an attribute on the servlet context has been replaced. Called
after the attribute is replaced. */
-public void attributeReplaced(ServletContextAttributeEvent scab);
+
+ /**
+ * Receives notification that an attribute has been added to the
+ * ServletContext.
+ *
+ * @param event the ServletContextAttributeEvent containing the
+ * ServletContext to which the attribute was added, along with the
+ * attribute name and value
+ */
+ public void attributeAdded(ServletContextAttributeEvent event);
+
+ /**
+ * Receives notification that an attribute has been removed
+ * from the ServletContext.
+ *
+ * @param event the ServletContextAttributeEvent containing the
+ * ServletContext from which the attribute was removed, along with
+ * the attribute name and value
+ */
+ public void attributeRemoved(ServletContextAttributeEvent event);
+
+ /*
+ * Receives notification that an attribute has been replaced
+ * in the ServletContext.
+ *
+ * @param event the ServletContextAttributeEvent containing the
+ * ServletContext in which the attribute was replaced, along with
+ * the attribute name and its old value
+ */
+ public void attributeReplaced(ServletContextAttributeEvent event);
}
Modified: trunk/java/javax/servlet/ServletContextListener.java
===================================================================
--- trunk/java/javax/servlet/ServletContextListener.java 2009-05-07 17:10:59 UTC (rev
1043)
+++ trunk/java/javax/servlet/ServletContextListener.java 2009-05-08 15:02:57 UTC (rev
1044)
@@ -52,41 +52,49 @@
* limitations under the License.
*/
-
-
package javax.servlet;
import java.util.EventListener;
- /**
- * Implementations of this interface receive notifications about
- * changes to the servlet context of the web application they are
- * part of.
- * To receive notification events, the implementation class
- * must be configured in the deployment descriptor for the web
- * application.
- * @see ServletContextEvent
- *
- * @since Servlet 2.3
- */
-
+/**
+ * Interface for receiving notification events about ServletContext
+ * lifecycle changes.
+ *
+ * <p>In order to receive these notification events, the implementation
+ * class must be either declared in the deployment descriptor of the web
+ * application or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
+ *
+ * @see ServletContextEvent
+ *
+ * @since Servlet 2.3
+ */
public interface ServletContextListener extends EventListener {
- /**
- ** Notification that the web application initialization
- ** process is starting.
- ** All ServletContextListeners are notified of context
- ** initialization before any filter or servlet in the web
- ** application is initialized.
- */
- public void contextInitialized ( ServletContextEvent sce );
+ /**
+ * Receives notification that the web application initialization
+ * process is starting.
+ *
+ * <p>All ServletContextListeners are notified of context
+ * initialization before any filters or servlets in the web
+ * application are initialized.
+ *
+ * @param sce the ServletContextEvent containing the ServletContext
+ * that is being initialized
+ */
+ public void contextInitialized(ServletContextEvent sce);
- /**
- ** Notification that the servlet context is about to be shut down.
- ** All servlets and filters have been destroy()ed before any
- ** ServletContextListeners are notified of context
- ** destruction.
- */
- public void contextDestroyed ( ServletContextEvent sce );
+ /**
+ * Receives notification that the ServletContext is about to be
+ * shut down.
+ *
+ * <p>All servlets and filters will have been destroyed before any
+ * ServletContextListeners are notified of context
+ * destruction.
+ *
+ * @param sce the ServletContextEvent containing the ServletContext
+ * that is being destroyed
+ */
+ public void contextDestroyed(ServletContextEvent sce);
}
Modified: trunk/java/javax/servlet/ServletRegistration.java
===================================================================
--- trunk/java/javax/servlet/ServletRegistration.java 2009-05-07 17:10:59 UTC (rev 1043)
+++ trunk/java/javax/servlet/ServletRegistration.java 2009-05-08 15:02:57 UTC (rev 1044)
@@ -65,6 +65,15 @@
public Set<String> addMapping(String... urlPatterns);
/**
+ * Gets an Iterable over the currently available mappings of the
+ * Servlet represented by this ServletRegistration.
+ *
+ * @return Iterable over the currently available mappings
+ * of the Servlet represented by this ServletRegistration.
+ */
+ public Iterable<String> getMappings();
+
+ /**
* Interface through which a {@link Servlet} registered via one of the
* <tt>addServlet</tt> methods on {@link ServletContext} may be further
* configured.
Modified: trunk/java/javax/servlet/ServletRequest.java
===================================================================
--- trunk/java/javax/servlet/ServletRequest.java 2009-05-07 17:10:59 UTC (rev 1043)
+++ trunk/java/javax/servlet/ServletRequest.java 2009-05-08 15:02:57 UTC (rev 1044)
@@ -599,10 +599,10 @@
/**
- * Gets the servlet context to which this servlet request was last
+ * Gets the servlet context to which this ServletRequest was last
* dispatched.
*
- * @return the servlet context to which this servlet request was last
+ * @return the servlet context to which this ServletRequest was last
* dispatched
*
* @since Servlet 3.0
Modified: trunk/java/javax/servlet/ServletRequestAttributeListener.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestAttributeListener.java 2009-05-07 17:10:59 UTC
(rev 1043)
+++ trunk/java/javax/servlet/ServletRequestAttributeListener.java 2009-05-08 15:02:57 UTC
(rev 1044)
@@ -52,38 +52,58 @@
* limitations under the License.
*/
-
-
package javax.servlet;
import java.util.EventListener;
+/**
+ * Interface for receiving notification events about ServletRequest
+ * attribute changes.
+ *
+ * <p>Notifications will be generated while the request
+ * is within the scope of the web application. A ServletRequest
+ * is defined as coming into scope of a web application when it
+ * is about to enter the first servlet or filter of the web
+ * application, and as going out of scope when it exits the last
+ * servlet or the first filter in the chain.
+ *
+ * <p>In order to receive these notification events, the implementation
+ * class must be either declared in the deployment descriptor of the web
+ * application or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
+ *
+ * @since Servlet 2.4
+ */
+
+public interface ServletRequestAttributeListener extends EventListener {
+
/**
- * A ServletRequestAttributeListener can be implemented by the
- * developer interested in being notified of request attribute
- * changes. Notifications will be generated while the request
- * is within the scope of the web application in which the listener
- * is registered. A request is defined as coming into scope when
- * it is about to enter the first servlet or filter in each web
- * application, as going out of scope when it exits the last servlet
- * or the first filter in the chain.
+ * Receives notification that an attribute has been added to the
+ * ServletRequest.
*
- * @since Servlet 2.4
+ * @param srae the ServletRequestAttributeEvent containing the
+ * ServletRequest and the name and value of the attribute that was
+ * added
*/
-
-public interface ServletRequestAttributeListener extends EventListener {
- /** Notification that a new attribute was added to the
- ** servlet request. Called after the attribute is added.
- */
public void attributeAdded(ServletRequestAttributeEvent srae);
- /** Notification that an existing attribute has been removed from the
- ** servlet request. Called after the attribute is removed.
+ /**
+ * Receives notification that an attribute has been removed from the
+ * ServletRequest.
+ *
+ * @param srae the ServletRequestAttributeEvent containing the
+ * ServletRequest and the name and value of the attribute that was
+ * removed
*/
public void attributeRemoved(ServletRequestAttributeEvent srae);
- /** Notification that an attribute was replaced on the
- ** servlet request. Called after the attribute is replaced.
+ /**
+ * Receives notification that an attribute has been replaced on the
+ * ServletRequest.
+ *
+ * @param srae the ServletRequestAttributeEvent containing the
+ * ServletRequest and the name and (old) value of the attribute
+ * that was replaced
*/
public void attributeReplaced(ServletRequestAttributeEvent srae);
}
Modified: trunk/java/javax/servlet/ServletRequestListener.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestListener.java 2009-05-07 17:10:59 UTC (rev
1043)
+++ trunk/java/javax/servlet/ServletRequestListener.java 2009-05-08 15:02:57 UTC (rev
1044)
@@ -52,29 +52,44 @@
* limitations under the License.
*/
-
-
package javax.servlet;
import java.util.EventListener;
+/**
+ * Interface for receiving notification events about requests coming
+ * into and going out of scope of a web application.
+ *
+ * <p>A ServletRequest is defined as coming into scope of a web
+ * application when it is about to enter the first servlet or filter
+ * of the web application, and as going out of scope as it exits
+ * the last servlet or the first filter in the chain.
+ *
+ * <p>In order to receive these notification events, the implementation
+ * class must be either declared in the deployment descriptor of the web
+ * application or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
+ *
+ * @since Servlet 2.4
+ */
+
+public interface ServletRequestListener extends EventListener {
+
/**
- * A ServletRequestListener can be implemented by the developer
- * interested in being notified of requests coming in and out of
- * scope in a web component. A request is defined as coming into
- * scope when it is about to enter the first servlet or filter
- * in each web application, as going out of scope when it exits
- * the last servlet or the first filter in the chain.
+ * Receives notification that a ServletRequest is about to go out
+ * of scope of the web application.
*
- * @since Servlet 2.4
+ * @param sre the ServletRequestEvent containing the ServletRequest
+ * and the ServletContext representing the web application
*/
+ public void requestDestroyed(ServletRequestEvent sre);
-
-public interface ServletRequestListener extends EventListener {
-
- /** The request is about to go out of scope of the web application. */
- public void requestDestroyed ( ServletRequestEvent sre );
-
- /** The request is about to come into scope of the web application. */
- public void requestInitialized ( ServletRequestEvent sre );
+ /**
+ * Receives notification that a ServletRequest is about to come
+ * into scope of the web application.
+ *
+ * @param sre the ServletRequestEvent containing the ServletRequest
+ * and the ServletContext representing the web application
+ */
+ public void requestInitialized(ServletRequestEvent sre);
}
Modified: trunk/java/javax/servlet/annotation/WebListener.java
===================================================================
--- trunk/java/javax/servlet/annotation/WebListener.java 2009-05-07 17:10:59 UTC (rev
1043)
+++ trunk/java/javax/servlet/annotation/WebListener.java 2009-05-08 15:02:57 UTC (rev
1044)
@@ -42,7 +42,15 @@
import java.lang.annotation.Target;
/**
- * This annotation is used to declare a WebListener
+ * This annotation is used to declare a WebListener.
+ *
+ * Any class annotated with WebListener must implement one or more of
+ * the {@link javax.servlet.ServletContextListener},
+ * {@link javax.servlet.ServletContextAttributeListener},
+ * {@link javax.servlet.ServletRequestListener},
+ * {@link javax.servlet.ServletRequestAttributeListener},
+ * {@link javax.servlet.http.HttpSessionListener}, or
+ * {@link javax.servlet.http.HttpSessionAttributeListener} interfaces.
*
* @since Servlet 3.0
*/
Modified: trunk/java/javax/servlet/http/HttpSessionAttributeListener.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionAttributeListener.java 2009-05-07 17:10:59
UTC (rev 1043)
+++ trunk/java/javax/servlet/http/HttpSessionAttributeListener.java 2009-05-08 15:02:57
UTC (rev 1044)
@@ -52,25 +52,50 @@
* limitations under the License.
*/
-
-
package javax.servlet.http;
import java.util.EventListener;
- /** This listener interface can be implemented in order to
- * get notifications of changes to the attribute lists of sessions within
- * this web application.
- * @since Servlet 2.3
-*/
+/**
+ * Interface for receiving notification events about HttpSession
+ * attribute changes.
+ *
+ * <p>In order to receive these notification events, the implementation
+ * class must be either declared in the deployment descriptor of the web
+ * application or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
+ *
+ * @since Servlet 2.3
+ */
public interface HttpSessionAttributeListener extends EventListener {
- /** Notification that an attribute has been added to a session. Called after the
attribute is added.*/
- public void attributeAdded ( HttpSessionBindingEvent se );
- /** Notification that an attribute has been removed from a session. Called after the
attribute is removed. */
- public void attributeRemoved ( HttpSessionBindingEvent se );
- /** Notification that an attribute has been replaced in a session. Called after the
attribute is replaced. */
- public void attributeReplaced ( HttpSessionBindingEvent se );
+ /**
+ * Receives notification that an attribute has been added to a
+ * session.
+ *
+ * @param event the HttpSessionBindingEvent containing the session
+ * and the name and value of the attribute that was added
+ */
+ public void attributeAdded(HttpSessionBindingEvent event);
+
+ /**
+ * Receives notification that an attribute has been removed from a
+ * session.
+ *
+ * @param event the HttpSessionBindingEvent containing the session
+ * and the name and value of the attribute that was removed
+ */
+ public void attributeRemoved(HttpSessionBindingEvent event);
+
+ /**
+ * Receives notification that an attribute has been replaced in a
+ * session.
+ *
+ * @param event the HttpSessionBindingEvent containing the session
+ * and the name and (old) value of the attribute that was replaced
+ */
+ public void attributeReplaced(HttpSessionBindingEvent event);
+
}
Modified: trunk/java/javax/servlet/http/HttpSessionListener.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionListener.java 2009-05-07 17:10:59 UTC (rev
1043)
+++ trunk/java/javax/servlet/http/HttpSessionListener.java 2009-05-08 15:02:57 UTC (rev
1044)
@@ -52,34 +52,38 @@
* limitations under the License.
*/
-
-
package javax.servlet.http;
import java.util.EventListener;
- /**
- * Implementations of this interface are notified of changes to the
- * list of active sessions in a web application.
- * To receive notification events, the implementation class
- * must be configured in the deployment descriptor for the web application.
- * @see HttpSessionEvent
- * @since Servlet 2.3
- */
-
+/**
+ * Interface for receiving notification events about HttpSession
+ * lifecycle changes.
+ *
+ * <p>In order to receive these notification events, the implementation
+ * class must be either declared in the deployment descriptor of the web
+ * application or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
+ *
+ * @see HttpSessionEvent
+ *
+ * @since Servlet 2.3
+ */
public interface HttpSessionListener extends EventListener {
- /**
- * Notification that a session was created.
- * @param se the notification event
- */
- public void sessionCreated ( HttpSessionEvent se );
+ /**
+ * Receives notification that a session has been created.
+ *
+ * @param se the HttpSessionEvent containing the session
+ */
+ public void sessionCreated(HttpSessionEvent se);
- /**
- * Notification that a session is about to be invalidated.
- * @param se the notification event
- */
- public void sessionDestroyed ( HttpSessionEvent se );
+ /**
+ * Receives notification that a session is about to be invalidated.
+ *
+ * @param se the HttpSessionEvent containing the session
+ */
+ public void sessionDestroyed(HttpSessionEvent se);
}
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-05-07 17:10:59 UTC
(rev 1043)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-05-08 15:02:57 UTC
(rev 1044)
@@ -52,7 +52,9 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -73,6 +75,7 @@
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
+import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Globals;
import org.apache.catalina.Host;
@@ -911,7 +914,7 @@
}
- public FilterRegistration findFilterRegistration(String filterName) {
+ public FilterRegistration getFilterRegistration(String filterName) {
ApplicationFilterConfig filterConfig =
context.findApplicationFilterConfig(filterName);
if (filterConfig == null) {
FilterDef filterDef = context.findFilterDef(filterName);
@@ -926,7 +929,7 @@
}
- public ServletRegistration findServletRegistration(String servletName) {
+ public ServletRegistration getServletRegistration(String servletName) {
Wrapper wrapper = (Wrapper) context.findChild(servletName);
if (wrapper != null) {
return wrapper.getFacade();
@@ -936,6 +939,29 @@
}
+ public Map<String, FilterRegistration> getFilterRegistrations() {
+ HashMap<String, FilterRegistration> result =
+ new HashMap<String, FilterRegistration>();
+ ApplicationFilterConfig[] filterConfigs =
context.findApplicationFilterConfigs();
+ for (int i = 0; i < filterConfigs.length; i++) {
+ result.put(filterConfigs[i].getFilterName(), filterConfigs[i].getFacade());
+ }
+ return Collections.unmodifiableMap(result);
+ }
+
+
+ public Map<String, ServletRegistration> getServletRegistrations() {
+ HashMap<String, ServletRegistration> result =
+ new HashMap<String, ServletRegistration>();
+ Container[] wrappers = context.findChildren();
+ for (int i = 0; i < wrappers.length; i++) {
+ Wrapper wrapper = (Wrapper) wrappers[i];
+ result.put(wrapper.getName(), wrapper.getFacade());
+ }
+ return Collections.unmodifiableMap(result);
+ }
+
+
/**
* By default {@link SessionTrackingMode#URL} is always supported, {@link
* SessionTrackingMode#COOKIE} is supported unless the
<code>cookies</code>
Modified: trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-05-07 17:10:59
UTC (rev 1043)
+++ trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-05-08 15:02:57
UTC (rev 1044)
@@ -58,6 +58,7 @@
import java.util.EnumSet;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import javax.servlet.Filter;
@@ -496,26 +497,46 @@
}
- public FilterRegistration findFilterRegistration(String filterName) {
+ public FilterRegistration getFilterRegistration(String filterName) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- return (FilterRegistration) doPrivileged("findFilterRegistration",
+ return (FilterRegistration) doPrivileged("getFilterRegistration",
new Object[]{filterName});
} else {
- return context.findFilterRegistration(filterName);
+ return context.getFilterRegistration(filterName);
}
}
- public ServletRegistration findServletRegistration(String servletName) {
+ public ServletRegistration getServletRegistration(String servletName) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- return (ServletRegistration)
doPrivileged("findServletRegistration",
+ return (ServletRegistration)
doPrivileged("getServletRegistration",
new Object[]{servletName});
} else {
- return context.findServletRegistration(servletName);
+ return context.getServletRegistration(servletName);
}
}
+
+
+ public Map<String, ServletRegistration> getServletRegistrations() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (Map<String, ServletRegistration>)
doPrivileged("getServletRegistrations",
+ new Object[]{});
+ } else {
+ return context.getServletRegistrations();
+ }
+ }
+ public Map<String, FilterRegistration> getFilterRegistrations() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (Map<String, FilterRegistration>)
doPrivileged("getFilterRegistrations",
+ new Object[]{});
+ } else {
+ return context.getFilterRegistrations();
+ }
+ }
+
+
public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (EnumSet<SessionTrackingMode>)
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-05-07 17:10:59
UTC (rev 1043)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-05-08 15:02:57
UTC (rev 1044)
@@ -50,6 +50,7 @@
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.EnumSet;
import java.util.Enumeration;
import java.util.HashMap;
@@ -122,7 +123,7 @@
/**
* The Context with which we are associated.
*/
- private Context context = null;
+ private transient Context context = null;
/**
@@ -161,9 +162,7 @@
* Return the name of the filter we are configuring.
*/
public String getFilterName() {
-
return (filterDef.getFilterName());
-
}
@@ -175,13 +174,12 @@
* @param name Name of the requested initialization parameter
*/
public String getInitParameter(String name) {
-
- Map map = filterDef.getParameterMap();
- if (map == null)
+ Map<String, String> map = filterDef.getParameterMap();
+ if (map == null) {
return (null);
- else
- return ((String) map.get(name));
-
+ } else {
+ return map.get(name);
+ }
}
@@ -189,14 +187,13 @@
* Return an <code>Enumeration</code> of the names of the initialization
* parameters for this Filter.
*/
- public Enumeration getInitParameterNames() {
-
- Map map = filterDef.getParameterMap();
- if (map == null)
- return (new Enumerator(new ArrayList()));
- else
+ public Enumeration<String> getInitParameterNames() {
+ Map<String, String> map = filterDef.getParameterMap();
+ if (map == null) {
+ return (new Enumerator(new ArrayList<String>()));
+ } else {
return (new Enumerator(map.keySet()));
-
+ }
}
@@ -204,9 +201,7 @@
* Return the ServletContext of our associated web application.
*/
public ServletContext getServletContext() {
-
return (this.context.getServletContext());
-
}
@@ -293,6 +288,44 @@
}
+ public Iterable<String> getServletNameMappings() {
+ HashSet<String> result = new HashSet<String>();
+ FilterMap[] filterMaps = context.findFilterMaps();
+ for (int i = 0; i < filterMaps.length; i++) {
+ if (filterDef.getFilterName().equals(filterMaps[i].getFilterName())) {
+ FilterMap filterMap = filterMaps[i];
+ String[] maps = filterMap.getServletNames();
+ for (int j = 0; j < maps.length; j++) {
+ result.add(maps[j]);
+ }
+ if (filterMap.getMatchAllServletNames()) {
+ result.add("*");
+ }
+ }
+ }
+ return Collections.unmodifiableSet(result);
+ }
+
+
+ public Iterable<String> getUrlPatternMappings() {
+ HashSet<String> result = new HashSet<String>();
+ FilterMap[] filterMaps = context.findFilterMaps();
+ for (int i = 0; i < filterMaps.length; i++) {
+ if (filterDef.getFilterName().equals(filterMaps[i].getFilterName())) {
+ FilterMap filterMap = filterMaps[i];
+ String[] maps = filterMap.getURLPatterns();
+ for (int j = 0; j < maps.length; j++) {
+ result.add(maps[j]);
+ }
+ if (filterMap.getMatchAllUrlPatterns()) {
+ result.add("*");
+ }
+ }
+ }
+ return Collections.unmodifiableSet(result);
+ }
+
+
public void setAsyncSupported(boolean asyncSupported) {
filterDef.setAsyncSupported(asyncSupported);
context.addFilterDef(filterDef);
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterConfigFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterConfigFacade.java 2009-05-07
17:10:59 UTC (rev 1043)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterConfigFacade.java 2009-05-08
15:02:57 UTC (rev 1044)
@@ -47,32 +47,18 @@
package org.apache.catalina.core;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.EnumSet;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import javax.naming.NamingException;
import javax.servlet.DispatcherType;
-import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import org.apache.catalina.Context;
-import org.apache.catalina.Globals;
-import org.apache.catalina.deploy.FilterDef;
-import org.apache.catalina.security.SecurityUtil;
-import org.apache.catalina.util.Enumerator;
-import org.apache.catalina.util.StringManager;
-import org.apache.tomcat.InstanceManager;
-import org.apache.tomcat.util.log.SystemLogHandler;
-
/**
* Facade for AppalicationFilterConfig.
*
@@ -83,9 +69,6 @@
public class ApplicationFilterConfigFacade implements FilterConfig, FilterRegistration {
- protected static StringManager sm =
- StringManager.getManager(Constants.Package);
-
public static class Dynamic extends ApplicationFilterConfigFacade
implements FilterRegistration.Dynamic {
@@ -120,9 +103,7 @@
* Return the name of the filter we are configuring.
*/
public String getFilterName() {
-
return config.getFilterName();
-
}
@@ -134,9 +115,7 @@
* @param name Name of the requested initialization parameter
*/
public String getInitParameter(String name) {
-
return config.getInitParameter(name);
-
}
@@ -144,10 +123,8 @@
* Return an <code>Enumeration</code> of the names of the initialization
* parameters for this Filter.
*/
- public Enumeration getInitParameterNames() {
-
+ public Enumeration<String> getInitParameterNames() {
return config.getInitParameterNames();
-
}
@@ -155,9 +132,7 @@
* Return the ServletContext of our associated web application.
*/
public ServletContext getServletContext() {
-
return config.getServletContext();
-
}
@@ -193,4 +168,29 @@
config.setDescription(description);
}
+
+ public Iterable<String> getServletNameMappings() {
+ return config.getServletNameMappings();
+ }
+
+
+ public Iterable<String> getUrlPatternMappings() {
+ return config.getUrlPatternMappings();
+ }
+
+
+ public String getClassName() {
+ return config.getFilterDef().getFilterClass();
+ }
+
+
+ public Map<String, String> getInitParameters() {
+ return Collections.unmodifiableMap(config.getFilterDef().getParameterMap());
+ }
+
+
+ public String getName() {
+ return config.getFilterName();
+ }
+
}
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-07 17:10:59 UTC (rev
1043)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-08 15:02:57 UTC (rev
1044)
@@ -2575,6 +2575,14 @@
/**
+ * Return the application filter for the given name.
+ */
+ public ApplicationFilterConfig[] findApplicationFilterConfigs() {
+ return filterConfigs.values().toArray(new ApplicationFilterConfig[0]);
+ }
+
+
+ /**
* Return the set of application listener class names configured
* for this application.
*/
Modified: trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-05-07 17:10:59 UTC
(rev 1043)
+++ trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-05-08 15:02:57 UTC
(rev 1044)
@@ -47,7 +47,9 @@
package org.apache.catalina.core;
+import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
@@ -201,4 +203,34 @@
}
+ public Iterable<String> getMappings() {
+ HashSet<String> result = new HashSet<String>();
+ String[] mappings = wrapper.findMappings();
+ for (int i = 0; i < mappings.length; i++) {
+ result.add(mappings[i]);
+ }
+ return Collections.unmodifiableSet(result);
+ }
+
+
+ public String getClassName() {
+ return wrapper.getServletClass();
+ }
+
+
+ public Map<String, String> getInitParameters() {
+ HashMap<String, String> result = new HashMap<String, String>();
+ String[] names = wrapper.findInitParameters();
+ for (int i = 0; i < names.length; i++) {
+ result.put(names[i], wrapper.getInitParameter(names[i]));
+ }
+ return Collections.unmodifiableMap(result);
+ }
+
+
+ public String getName() {
+ return wrapper.getName();
+ }
+
+
}
Modified: trunk/java/org/apache/jasper/servlet/JspCServletContext.java
===================================================================
--- trunk/java/org/apache/jasper/servlet/JspCServletContext.java 2009-05-07 17:10:59 UTC
(rev 1043)
+++ trunk/java/org/apache/jasper/servlet/JspCServletContext.java 2009-05-08 15:02:57 UTC
(rev 1044)
@@ -27,6 +27,7 @@
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Hashtable;
+import java.util.Map;
import java.util.Set;
import java.util.Vector;
@@ -525,4 +526,24 @@
}
+ public FilterRegistration getFilterRegistration(String filterName) {
+ return null;
+ }
+
+
+ public Map<String, FilterRegistration> getFilterRegistrations() {
+ return null;
+ }
+
+
+ public ServletRegistration getServletRegistration(String servletName) {
+ return null;
+ }
+
+
+ public Map<String, ServletRegistration> getServletRegistrations() {
+ return null;
+ }
+
+
}