Update spec classes for latest Servlet 3.0 API as of 2009-10-15.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Oct 2009 13:41:59 +0000 (13:41 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Oct 2009 13:41:59 +0000 (13:41 +0000)
Update internals so Tomcat builds with the updated spec. Lots if stubbed impl marked with TODO.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@827435 13f79535-47bb-0310-9956-ffa450edef68

48 files changed:
java/javax/servlet/AsyncContext.java
java/javax/servlet/AsyncEvent.java
java/javax/servlet/AsyncListener.java
java/javax/servlet/DispatcherType.java
java/javax/servlet/FilterRegistration.java
java/javax/servlet/HttpConstraintElement.java [new file with mode: 0644]
java/javax/servlet/HttpMethodConstraintElement.java [new file with mode: 0644]
java/javax/servlet/LocalStrings.properties
java/javax/servlet/MultipartConfigElement.java [new file with mode: 0644]
java/javax/servlet/Registration.java
java/javax/servlet/ServletContainerInitializer.java
java/javax/servlet/ServletContext.java
java/javax/servlet/ServletOutputStream.java
java/javax/servlet/ServletRegistration.java
java/javax/servlet/ServletRequest.java
java/javax/servlet/ServletRequestWrapper.java
java/javax/servlet/ServletSecurityElement.java [new file with mode: 0644]
java/javax/servlet/annotation/HandlesTypes.java
java/javax/servlet/annotation/HttpConstraint.java [new file with mode: 0644]
java/javax/servlet/annotation/HttpMethodConstraint.java [new file with mode: 0644]
java/javax/servlet/annotation/MultipartConfig.java
java/javax/servlet/annotation/ServletSecurity.java [new file with mode: 0644]
java/javax/servlet/annotation/WebFilter.java
java/javax/servlet/annotation/WebInitParam.java
java/javax/servlet/annotation/WebListener.java
java/javax/servlet/annotation/WebServlet.java
java/javax/servlet/descriptor/JspConfigDescriptor.java [new file with mode: 0644]
java/javax/servlet/descriptor/JspPropertyGroupDescriptor.java [new file with mode: 0644]
java/javax/servlet/descriptor/TaglibDescriptor.java [new file with mode: 0644]
java/javax/servlet/http/HttpServletRequest.java
java/javax/servlet/http/HttpServletRequestWrapper.java
java/javax/servlet/http/HttpServletResponse.java
java/javax/servlet/http/HttpServletResponseWrapper.java
java/javax/servlet/http/Part.java
java/org/apache/catalina/connector/Request.java
java/org/apache/catalina/connector/RequestFacade.java
java/org/apache/catalina/connector/Response.java
java/org/apache/catalina/connector/ResponseFacade.java
java/org/apache/catalina/core/ApplicationContext.java
java/org/apache/catalina/core/ApplicationContextFacade.java
java/org/apache/catalina/core/AsyncContextImpl.java
java/org/apache/catalina/core/DummyRequest.java
java/org/apache/catalina/core/DummyResponse.java
java/org/apache/jasper/servlet/JspCServletContext.java
webapps/examples/WEB-INF/classes/async/Async0.java
webapps/examples/WEB-INF/classes/async/Async1.java
webapps/examples/WEB-INF/classes/async/Async2.java
webapps/examples/WEB-INF/classes/async/Async3.java

index f543612..66dec45 100644 (file)
@@ -64,7 +64,15 @@ public interface AsyncContext {
     
     void start(Runnable run);
     
-    public long getAsyncTimeout();
+    void addListener(AsyncListener listener);
     
-    public void setAsyncTimeout(long timeout);
+    void addListener(AsyncListener listener, ServletRequest request,
+            ServletResponse response);
+    
+    <T extends AsyncListener> T createListener(Class<T> clazz)
+    throws ServletException;
+    
+    long getTimeout();
+    
+    void setTimeout(long timeout);
 }
index 6ba2f0c..cde7347 100644 (file)
@@ -18,23 +18,51 @@ package javax.servlet;
 
 /**
  * @since Servlet 3.0
- * $Id$
  * TODO SERVLET3 - Add comments
  */
 public class AsyncEvent {
+    private AsyncContext context;
     private ServletRequest request;
     private ServletResponse response;
+    private Throwable throwable;
     
-    public AsyncEvent(ServletRequest request, ServletResponse response) {
+    public AsyncEvent(AsyncContext context) {
+        this.context = context;
+    }
+
+    public AsyncEvent(AsyncContext context, ServletRequest request,
+            ServletResponse response) {
+        this.context = context;
+        this.request = request;
+        this.response = response;
+    }
+    
+    public AsyncEvent(AsyncContext context, Throwable throwable) {
+        this.context = context;
+        this.throwable = throwable;
+    }
+
+    public AsyncEvent(AsyncContext context, ServletRequest request,
+            ServletResponse response, Throwable throwable) {
+        this.context = context;
         this.request = request;
         this.response = response;
+        this.throwable = throwable;
     }
     
-    public ServletRequest getRequest() {
+    public AsyncContext getAsyncContext() {
+        return context;
+    }
+
+    public ServletRequest getSuppliedRequest() {
         return request;
     }
     
-    public ServletResponse getResponse() {
+    public ServletResponse getSuppliedResponse() {
         return response;
     }
+    
+    public Throwable getThrowable() {
+        return throwable;
+    }
 }
index 01dd54b..78a3791 100644 (file)
@@ -28,4 +28,5 @@ public interface AsyncListener extends EventListener {
     void onComplete(AsyncEvent event) throws IOException;
     void onTimeout(AsyncEvent event) throws IOException;
     void onError(AsyncEvent event) throws IOException;
+    void onStartAsync(AsyncEvent event) throws IOException;
 }
index d68acb2..67e5603 100644 (file)
@@ -18,7 +18,6 @@ package javax.servlet;
 
 /**
  * @since Servlet 3.0
- * $Id$
  */
 public enum DispatcherType {
     FORWARD,
index 59967a0..3f54f95 100644 (file)
 */
 package javax.servlet;
 
+import java.util.Collection;
 import java.util.EnumSet;
 
 /**
  * @since Servlet 3.0
- * $Id$
  * TODO SERVLET3 - Add comments
  */
 public interface FilterRegistration extends Registration {
@@ -36,6 +36,11 @@ public interface FilterRegistration extends Registration {
     public void addMappingForServletNames(
             EnumSet<DispatcherType> dispatcherTypes,
             boolean isMatchAfter, String... servletNames);
+    /**
+     * 
+     * @return
+     */
+    public Collection<String> getServletNameMappings();
     
     /**
      * 
@@ -49,7 +54,14 @@ public interface FilterRegistration extends Registration {
             EnumSet<DispatcherType> dispatcherTypes,
             boolean isMatchAfter, String... urlPatterns);
 
+    /**
+     * 
+     * @return
+     */
+    public Collection<String> getUrlPatternMappings();
+    
     public static interface Dynamic
     extends FilterRegistration, Registration.Dynamic {
+        // No additional methods
     }
 }
diff --git a/java/javax/servlet/HttpConstraintElement.java b/java/javax/servlet/HttpConstraintElement.java
new file mode 100644 (file)
index 0000000..cb9ae8e
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+* 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 javax.servlet;
+
+import java.util.ResourceBundle;
+
+import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
+import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public class HttpConstraintElement {
+    
+    private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
+    protected static final ResourceBundle lStrings =
+        ResourceBundle.getBundle(LSTRING_FILE);
+
+    private EmptyRoleSemantic emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
+    private TransportGuarantee transportGuarantee = TransportGuarantee.NONE;
+    private String[] rolesAllowed = new String[0];
+    
+    /**
+     * Default constraint is permit with no transport guarantee.
+     */
+    public HttpConstraintElement() {
+        // Default constructor
+    }
+    
+    /**
+     * Convenience constructor for {@link EmptyRoleSemantic.DENY}.
+     * 
+     */
+    public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic) {
+        this.emptyRoleSemantic = emptyRoleSemantic;
+    }
+    
+    /**
+     * Convenience constructor to specify transport guarantee and/or roles.
+     */
+    public HttpConstraintElement(TransportGuarantee transportGuarantee,
+            String... rolesAllowed) {
+        this.transportGuarantee = transportGuarantee;
+        this.rolesAllowed = rolesAllowed;
+    }
+
+    /**
+     * 
+     * @param emptyRoleSemantic
+     * @param transportGuarantee
+     * @param rolesAllowed
+     * @throws IllegalArgumentException if roles are specified when DENY is used
+     */
+    public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic,
+            TransportGuarantee transportGuarantee, String... rolesAllowed) {
+        if (rolesAllowed != null && rolesAllowed.length > 0 &&
+                EmptyRoleSemantic.DENY.equals(emptyRoleSemantic)) {
+            throw new IllegalArgumentException(lStrings.getString(
+                    "httpConstraintElement.invalidRolesDeny"));
+        }
+        this.emptyRoleSemantic = emptyRoleSemantic;
+        this.transportGuarantee = transportGuarantee;
+        this.rolesAllowed = rolesAllowed;
+    }
+    
+    public EmptyRoleSemantic getEmptyRoleSemantic() {
+        return emptyRoleSemantic;
+    }
+    
+    public TransportGuarantee getTransportGuarantee() {
+        return transportGuarantee;
+    }
+    
+    public String[] getRolesAllowed() {
+        return rolesAllowed;
+    }
+}
\ No newline at end of file
diff --git a/java/javax/servlet/HttpMethodConstraintElement.java b/java/javax/servlet/HttpMethodConstraintElement.java
new file mode 100644 (file)
index 0000000..025a5d6
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+* 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 javax.servlet;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public class HttpMethodConstraintElement extends HttpConstraintElement {
+    
+    private String methodName;
+
+    public HttpMethodConstraintElement(String methodName) {
+        if (methodName == null || methodName.length() == 0) {
+            throw new IllegalArgumentException(lStrings.getString(
+                    "httpMethodConstraintElement.invalidMethod"));
+        }
+        this.methodName = methodName;
+    }
+    
+    public HttpMethodConstraintElement(String methodName,
+            HttpConstraintElement constraint) {
+        super(constraint.getEmptyRoleSemantic(),
+                constraint.getTransportGuarantee(),
+                constraint.getRolesAllowed());
+        if (methodName == null || methodName.length() == 0) {
+            throw new IllegalArgumentException(lStrings.getString(
+                    "httpMethodConstraintElement.invalidMethod"));
+        }
+        this.methodName = methodName;
+    }
+    
+    public String getMethodName() {
+        return methodName;
+    }
+}
\ No newline at end of file
index 49fb287..0f60d51 100644 (file)
@@ -19,3 +19,6 @@
 err.not_iso8859_1=Not an ISO 8859-1 character: {0}
 value.true=true
 value.false=false
+
+httpConstraintElement.invalidRolesDeny=Roles may not be specified when using DENY
+httpMethodConstraintElement.invalidMethod=Invalid HTTP method
\ No newline at end of file
diff --git a/java/javax/servlet/MultipartConfigElement.java b/java/javax/servlet/MultipartConfigElement.java
new file mode 100644 (file)
index 0000000..fb6934c
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+* 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 javax.servlet;
+
+import javax.servlet.annotation.MultipartConfig;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public class MultipartConfigElement {
+    
+    private String location = "";
+    private long maxFileSize = -1;
+    private long maxRequestSize = -1;
+    private int fileSizeThreshold = 0;
+    
+    public MultipartConfigElement(String location) {
+        // Keep empty string default if location is null
+        if (location != null) {
+            this.location = location;
+        }
+    }
+    
+    public MultipartConfigElement(String location, long maxFileSize,
+            long maxRequestSize, int fileSizeThreshold) {
+        // Keep empty string default if location is null
+        if (location != null) {
+            this.location = location;
+        }
+        this.maxFileSize = maxFileSize;
+        this.maxRequestSize = maxRequestSize;
+        this.fileSizeThreshold = fileSizeThreshold;
+    }
+    
+    public MultipartConfigElement(MultipartConfig annotation) {
+        location = annotation.location();
+        maxFileSize = annotation.maxFileSize();
+        maxRequestSize = annotation.maxRequestSize();
+        fileSizeThreshold = annotation.fileSizeThreshold();
+    }
+    
+    public String getLocation() {
+        return location;
+    }
+    
+    public long getMaxFileSize() {
+        return maxFileSize;
+    }
+    
+    public long getMaxRequestSize() {
+        return maxRequestSize;
+    }
+    
+    public int getFileSizeThreshold() {
+        return fileSizeThreshold;
+    }
+}
\ No newline at end of file
index f45594d..fe09cc5 100644 (file)
@@ -26,18 +26,40 @@ import java.util.Set;
  */
 public interface Registration {
     
-    public boolean setInitParameter(String name, String value)
-    throws IllegalArgumentException, IllegalStateException;
+    public String getName();
+    
+    public String getClassName();
 
-    public Set<String> setInitParameters(Map<String,String> initParameters)
-    throws IllegalArgumentException, IllegalStateException;
+    /**
+     * 
+     * @param name
+     * @param value
+     * @return
+     * @throws IllegalArgumentException
+     * @throws IllegalStateException
+     */
+    public boolean setInitParameter(String name, String value);
 
-    public interface Dynamic {
-        
-        public void setDescription(String description)
-        throws IllegalStateException;
+    public String getInitParameter(String name);
+    
+    /**
+     * 
+     * @param initParameters
+     * @return
+     * @throws IllegalArgumentException
+     * @throws IllegalStateException
+     */
+    public Set<String> setInitParameters(Map<String,String> initParameters);
+
+    public Map<String, String> getInitParameters();
+
+    public interface Dynamic extends Registration {
         
-        public void setAsyncSupported(boolean isAsyncSupported)
-        throws IllegalStateException;
+        /**
+         * 
+         * @param isAsyncSupported
+         * @throws IllegalStateException
+         */
+        public void setAsyncSupported(boolean isAsyncSupported);
     }
 }
index 6c8d458..c16ed8e 100644 (file)
 */
 package javax.servlet;
 
+import java.util.Set;
+
 /**
  * @since Servlet 3.0
  * $Id$
  * TODO SERVLET3 - Add comments
  */
 public interface ServletContainerInitializer {
-    public void onStartup(java.util.Set<java.lang.Class<?>> c,
-            ServletContext ctx);
+    
+    /**
+     * 
+     * @param c
+     * @param ctx
+     * @throws ServletException
+     */
+    public void onStartup(Set<java.lang.Class<?>> c, ServletContext ctx)
+    throws ServletException;
 }
index 6a6d6e4..25eb162 100644 (file)
@@ -21,8 +21,12 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.EnumSet;
 import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Map;
 import java.util.Set;
 
+import javax.servlet.descriptor.JspConfigDescriptor;
+
 /**
  * 
  * Defines a set of methods that a servlet uses to communicate with its
@@ -56,6 +60,12 @@ import java.util.Set;
 public interface ServletContext {
 
     public static final String TEMPDIR = "javax.servlet.context.tempdir";
+    
+    /**
+     * @since Servlet 3.0
+     */
+    public static final String ORDERED_LIBS =
+        "javax.servlet.context.orderedLibs";
 
     /**
      * Returns a <code>ServletContext</code> object that 
@@ -114,7 +124,23 @@ public interface ServletContext {
 
     public int getMinorVersion();
     
+    /**
+     * 
+     * @return
+     * @throws UnsupportedOperationException
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public int getEffectiveMajorVersion();
     
+    /**
+     * 
+     * @return
+     * @throws UnsupportedOperationException
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public int getEffectiveMinorVersion();
 
     /**
      * Returns the MIME type of the specified file, or <code>null</code> if 
@@ -532,6 +558,7 @@ public interface ServletContext {
      * @param value
      * @return
      * @throws IllegalStateException
+     * @throws UnsupportedOperationException
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
@@ -710,10 +737,21 @@ public interface ServletContext {
      * 
      * @param servletName
      * @return
+     * @throws UnsupportedOperationException
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public ServletRegistration getServletRegistration(String servletName);
+    
+    
+    /**
+     * 
+     * @return
+     * @throws UnsupportedOperationException
      * @since Servlet 3.0 
      * TODO SERVLET3 - Add comments
      */
-    public ServletRegistration findServletRegistration(String servletName);
+    public Map<String, ? extends ServletRegistration> getServletRegistrations();
 
 
     /**
@@ -774,15 +812,25 @@ public interface ServletContext {
      * 
      * @param filterName
      * @return
+     * @throws UnsupportedOperationException
      * @since Servlet 3.0 
      * TODO SERVLET3 - Add comments
      */
-    public FilterRegistration findFilterRegistration(String filterName);
+    public FilterRegistration getFilterRegistration(String filterName);
 
+    /**
+     * 
+     * @return
+     * @throws UnsupportedOperationException
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public Map<String, ? extends FilterRegistration> getFilterRegistrations();
 
     /**
      * 
      * @return
+     * @throws UnsupportedOperationException
      * @since Servlet 3.0 
      * TODO SERVLET3 - Add comments
      */
@@ -797,6 +845,7 @@ public interface ServletContext {
      *                                  {@link SessionTrackingMode}
      * @throws IllegalStateException    If the context has already been
      *                                  initialised
+     * @throws UnsupportedOperationException
      * @since Servlet 3.0 
      * TODO SERVLET3 - Add comments
      */
@@ -810,14 +859,80 @@ public interface ServletContext {
      * @since Servlet 3.0 
      * TODO SERVLET3 - Add comments
      */
-    public EnumSet<SessionTrackingMode> getDefaultSessionTrackingModes();
+    public Set<SessionTrackingMode> getDefaultSessionTrackingModes();
+    
+    /**
+     * 
+     * @return
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public Set<SessionTrackingMode> getEffectiveSessionTrackingModes();
+    
+    /**
+     * 
+     * @param listenerClass
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public void addListener(Class <? extends EventListener> listenerClass);
+    
+    /**
+     * 
+     * @param className
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public void addListener(String className);
+
+    /**
+     * 
+     * @param <T>
+     * @param t
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public <T extends EventListener> void addListener(T t);
+    
+    /**
+     * 
+     * @param <T>
+     * @param c
+     * @return
+     * @throws ServletException
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public <T extends EventListener> T createListener(Class<T> c)
+    throws ServletException;
+    
+    /**
+     * 
+     * @param roleNames
+     * @throws UnsupportedOperationException
+     * @throws IllegalArgumentException
+     * @throws IllegalStateException
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public void declareRoles(String... roleNames);
     
     /**
      * 
      * @return
+     * @throws UnsupportedOperationException
+     * @throws SecurityException
      * @since Servlet 3.0 
      * TODO SERVLET3 - Add comments
      */
-    public EnumSet<SessionTrackingMode> getEffectiveSessionTrackingModes();
+    public ClassLoader getClassLoader();
     
+    /**
+     * 
+     * @return
+     * @throws UnsupportedOperationException
+     * @since Servlet 3.0 
+     * TODO SERVLET3 - Add comments
+     */
+    public JspConfigDescriptor getJspConfigDescriptor();
 }
index 82785b3..6d8fb18 100644 (file)
@@ -43,8 +43,8 @@ import java.util.ResourceBundle;
 public abstract class ServletOutputStream extends OutputStream {
 
     private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
-    private static ResourceBundle lStrings =
-       ResourceBundle.getBundle(LSTRING_FILE);
+    private static final ResourceBundle lStrings =
+        ResourceBundle.getBundle(LSTRING_FILE);
 
 
     
index 3248ba4..3d2fee3 100644 (file)
@@ -16,6 +16,7 @@
 */
 package javax.servlet;
 
+import java.util.Collection;
 import java.util.Set;
 
 /**
@@ -33,10 +34,17 @@ public interface ServletRegistration extends Registration {
      * @throws IllegalStateException if the associated ServletContext has
      *                                  already been initialised
      */
-    public Set<String> addMapping(String... urlPatterns); 
+    public Set<String> addMapping(String... urlPatterns);
+    
+    public Collection<String> getMappings();
+    
+    public String getRunAsRole();
     
     public static interface Dynamic
     extends ServletRegistration, Registration.Dynamic {
-        
+        public void setLoadOnStartup(int loadOnStartup);
+        public void setMultipartConfig(MultipartConfigElement multipartConfig);
+        public void setRunAsRole(String roleName);
+        public Set<String> setServletSecurity(ServletSecurityElement constraint);
     }
 }
index 8d6873b..70932f2 100644 (file)
@@ -651,44 +651,6 @@ public interface ServletRequest {
 
     /**
      * 
-     * @param listener
-     * @since Servlet 3.0
-     * TODO SERVLET3 - Add comments
-     */
-    public void addAsyncListener(AsyncListener listener);
-
-    /**
-     * 
-     * @param listener
-     * @param servletRequest
-     * @param servletResponse
-     * @since Servlet 3.0
-     * TODO SERVLET3 - Add comments
-     */
-    public void addAsyncListener(AsyncListener listener,
-            ServletRequest servletRequest, ServletResponse servletResponse);
-    
-    /**
-     * 
-     * @param timeout
-     * @throws java.lang.IllegalStateException
-     * @since Servlet 3.0
-     * TODO SERVLET3 - Add comments
-     */
-    public void setAsyncTimeout(long timeout);
-    
-    
-    /**
-     * 
-     * @return
-     * @since Servlet 3.0
-     * TODO SERVLET3 - Add comments
-     */
-    public long getAsyncTimeout();
-
-    
-    /**
-     * 
      * @return
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
index 755a965..a6c2b78 100644 (file)
@@ -471,53 +471,6 @@ public class ServletRequestWrapper implements ServletRequest {
     }
 
     /**
-     * The default behavior of this method is to call
-     * addAsyncListener(AsyncListener) on the wrapped request object.
-     * 
-     * @param listener
-     * @since Servlet 3.0
-     */
-    public void addAsyncListener(AsyncListener listener) {
-        request.addAsyncListener(listener);
-    }
-    
-    /**
-     * The default behavior of this method is to call
-     * addAsyncListener(AsyncListener, ServletRequest, ServletResponse) on the
-     * wrapped request object.
-     * 
-     * @param listener
-     * @param servletRequest
-     * @param servletResponse
-     * @since Servlet 3.0
-     */
-    public void addAsyncListener(AsyncListener listener,
-            ServletRequest servletRequest, ServletResponse servletResponse) {
-        request.addAsyncListener(listener, servletRequest, servletResponse);
-    }
-    
-    /**
-     * The default behavior of this method is to call
-     * setAsyncTimeout(long) on the wrapped request object.
-     * 
-     * @param listener
-     * @since Servlet 3.0
-     */
-    public void setAsyncTimeout(long timeout) {
-        request.setAsyncTimeout(timeout);
-    }
-    
-    /**
-     * The default behavior of this method is to call
-     * getAsyncTimeout() on the wrapped request object.
-     * 
-     * @since Servlet 3.0
-     */
-    public long getAsyncTimeout() {
-        return request.getAsyncTimeout();
-    }
-    
-    /**
      * 
      * @param wrapped
      * @since Servlet 3.0
diff --git a/java/javax/servlet/ServletSecurityElement.java b/java/javax/servlet/ServletSecurityElement.java
new file mode 100644 (file)
index 0000000..0335825
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * 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 javax.servlet;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.annotation.HttpMethodConstraint;
+import javax.servlet.annotation.ServletSecurity;
+
+/**
+ * 
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public class ServletSecurityElement extends HttpConstraintElement {
+    
+    private Map<String,HttpMethodConstraintElement> methodConstraints =
+        new HashMap<String,HttpMethodConstraintElement>();
+
+    /**
+     * Use default HttpConstraint.
+     */
+    public ServletSecurityElement() {
+        super();
+    }
+    
+    
+    /**
+     * Use specific constraints for specified methods and default
+     * HttpConstraintElement for all other methods.
+     * @param httpMethodConstraints
+     * @throws IllegalArgumentException if a method name is specified more than
+     * once
+     */
+    public ServletSecurityElement(
+            Collection<HttpMethodConstraintElement> httpMethodConstraints) {
+        super();
+        addHttpMethodConstraints(httpMethodConstraints);
+    }
+    
+    /**
+     * Use specified HttpConstraintElement.
+     * @param httpConstraintElement
+     */
+    public ServletSecurityElement(HttpConstraintElement httpConstraintElement) {
+        this (httpConstraintElement, null);
+    }
+    
+    /**
+     * Use specified HttpConstraintElement as default and specific constraints
+     * for specified methods.
+     * @param httpConstraintElement
+     * @param httpMethodConstraints
+     * @throws IllegalArgumentException if a method name is specified more than
+     */
+    public ServletSecurityElement(HttpConstraintElement httpConstraintElement,
+            Collection<HttpMethodConstraintElement> httpMethodConstraints) {
+        super(httpConstraintElement.getEmptyRoleSemantic(),
+                httpConstraintElement.getTransportGuarantee(),
+                httpConstraintElement.getRolesAllowed());
+        addHttpMethodConstraints(httpMethodConstraints);
+    }
+    
+    /**
+     * Create from an annotation.
+     * @param annotation
+     * @throws IllegalArgumentException if a method name is specified more than
+     */
+    public ServletSecurityElement(ServletSecurity annotation) {
+        this(new HttpConstraintElement(annotation.value().value(),
+                annotation.value().transportGuarantee(),
+                annotation.value().rolesAllowed()));
+        
+        List<HttpMethodConstraintElement> l =
+            new ArrayList<HttpMethodConstraintElement>();
+        HttpMethodConstraint[] constraints = annotation.httpMethodConstraints();
+        if (constraints != null) {
+            for (int i = 0; i < constraints.length; i++) {
+                HttpMethodConstraintElement e =
+                    new HttpMethodConstraintElement(constraints[i].value(),
+                            new HttpConstraintElement(
+                                    constraints[i].emptyRoleSemantic(),
+                                    constraints[i].transportGuarantee(),
+                                    constraints[i].rolesAllowed()));
+                l.add(e);
+            }
+        }
+        addHttpMethodConstraints(l);
+    }
+    
+    public Collection<HttpMethodConstraintElement> getHttpMethodConstraints() {
+        return methodConstraints.values();
+    }
+    
+    public Collection<String> getMethodNames() {
+        return methodConstraints.keySet();
+    }
+    
+    private void addHttpMethodConstraints(
+            Collection<HttpMethodConstraintElement> httpMethodConstraints) {
+        if (httpMethodConstraints == null) {
+            return;
+        }
+        for (HttpMethodConstraintElement constraint : httpMethodConstraints) {
+            String method = constraint.getMethodName();
+            if (methodConstraints.containsKey(method)) {
+                throw new IllegalArgumentException(
+                        "Duplicate method name: " + method);
+            }
+            methodConstraints.put(method, constraint);
+        }
+    }
+}
index 82ec9f6..d32c71e 100644 (file)
@@ -24,7 +24,6 @@ import java.lang.annotation.Target;
 
 /**
  * @since Servlet 3.0
- * $Id$
  * TODO SERVLET3 - Add comments
  */
 @Target({ElementType.TYPE})
diff --git a/java/javax/servlet/annotation/HttpConstraint.java b/java/javax/servlet/annotation/HttpConstraint.java
new file mode 100644 (file)
index 0000000..3904507
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
+import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface HttpConstraint {
+    EmptyRoleSemantic value() default EmptyRoleSemantic.PERMIT;
+    TransportGuarantee transportGuarantee() default TransportGuarantee.NONE;
+    String[] rolesAllowed() default {};
+}
diff --git a/java/javax/servlet/annotation/HttpMethodConstraint.java b/java/javax/servlet/annotation/HttpMethodConstraint.java
new file mode 100644 (file)
index 0000000..58b49eb
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
+import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface HttpMethodConstraint {
+    String value();
+    EmptyRoleSemantic emptyRoleSemantic() default EmptyRoleSemantic.PERMIT;
+    TransportGuarantee transportGuarantee() default TransportGuarantee.NONE;
+    String[] rolesAllowed() default {};
+}
index 9bdeab5..fe2ee17 100644 (file)
@@ -24,7 +24,6 @@ import java.lang.annotation.Target;
 
 /**
  * @since Servlet 3.0
- * $Id$
  * TODO SERVLET3 - Add comments
  */
 @Target({ElementType.TYPE})
@@ -32,7 +31,7 @@ import java.lang.annotation.Target;
 @Documented
 public @interface MultipartConfig {
     String location() default "";
-    long maxFileSize() default 0L;
-    long maxRequestSize() default 0L;
+    long maxFileSize() default -1L;
+    long maxRequestSize() default -1L;
     int fileSizeThreshold() default 0;
 }
diff --git a/java/javax/servlet/annotation/ServletSecurity.java b/java/javax/servlet/annotation/ServletSecurity.java
new file mode 100644 (file)
index 0000000..b66b656
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+@Inherited
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface ServletSecurity {
+    enum EmptyRoleSemantic {
+        PERMIT,
+        DENY
+    }
+    enum TransportGuarantee {
+        NONE,
+        CONFIDENTIAL
+    }
+    HttpConstraint value() default @HttpConstraint;
+    HttpMethodConstraint[] httpMethodConstraints() default {};
+}
index a3946a4..bc06625 100644 (file)
@@ -26,7 +26,6 @@ import javax.servlet.DispatcherType;
 
 /**
  * @since Servlet 3.0
- * $Id$
  * TODO SERVLET3 - Add comments
  */
 @Target({ElementType.TYPE})
index b77ac46..9a2315a 100644 (file)
@@ -24,7 +24,6 @@ import java.lang.annotation.Documented;
 
 /**
  * @since Servlet 3.0
- * $Id$
  * TODO SERVLET3 - Add comments
  */
 @Target({ElementType.TYPE})
index 5f7168f..0463bd6 100644 (file)
@@ -24,12 +24,11 @@ import java.lang.annotation.Documented;
 
 /**
  * @since Servlet 3.0
- * $Id$
  * TODO SERVLET3 - Add comments
  */
 @Target({ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
 public @interface WebListener {
-    String description() default "";
+    String value() default "";
 }
index 3f3b386..4150314 100644 (file)
@@ -24,7 +24,6 @@ import java.lang.annotation.Documented;
 
 /**
  * @since Servlet 3.0
- * $Id$
  * TODO SERVLET3 - Add comments
  */
 @Target({ElementType.TYPE})
diff --git a/java/javax/servlet/descriptor/JspConfigDescriptor.java b/java/javax/servlet/descriptor/JspConfigDescriptor.java
new file mode 100644 (file)
index 0000000..8296d44
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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 javax.servlet.descriptor;
+
+import java.util.Collection;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface JspConfigDescriptor {
+    public Collection<TaglibDescriptor> getTaglibs();
+    public Collection<JspPropertyGroupDescriptor> getJspPropertyGroups();
+}
diff --git a/java/javax/servlet/descriptor/JspPropertyGroupDescriptor.java b/java/javax/servlet/descriptor/JspPropertyGroupDescriptor.java
new file mode 100644 (file)
index 0000000..25c71a9
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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 javax.servlet.descriptor;
+
+import java.util.Collection;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface JspPropertyGroupDescriptor {
+    public Collection<String> getUrlPatterns();
+    public String getElIgnored();
+    public String getPageEncoding();
+    public String getScriptingInvalid();
+    public String getIsXml();
+    public Collection<String> getIncludePreludes();
+    public Collection<String> getIncludeCodas();
+    public String getDeferredSyntaxAllowedAsLiteral();
+    public String getTrimDirectiveWhitespaces();
+    public String getDefaultContentType();
+    public String getBuffer();
+    public String getErrorOnUndeclaredNamespace();
+}
diff --git a/java/javax/servlet/descriptor/TaglibDescriptor.java b/java/javax/servlet/descriptor/TaglibDescriptor.java
new file mode 100644 (file)
index 0000000..208640b
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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 javax.servlet.descriptor;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface TaglibDescriptor {
+    public String getTaglidURI();
+    public String getTaglibLocation();
+}
index 6f7f1cd..194f85a 100644 (file)
@@ -21,6 +21,7 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 
 import java.io.IOException;
+import java.util.Collection;
 import java.util.Enumeration;
 
 /**
@@ -681,7 +682,7 @@ public interface HttpServletRequest extends ServletRequest {
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public void login(java.lang.String username, String password)
+    public void login(String username, String password)
     throws ServletException;
     
     
@@ -700,7 +701,7 @@ public interface HttpServletRequest extends ServletRequest {
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public Iterable<Part> getParts();
+    public Collection<Part> getParts() throws IOException, ServletException;
     
     
     /**
@@ -711,5 +712,5 @@ public interface HttpServletRequest extends ServletRequest {
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public Part getPart(java.lang.String name);
+    public Part getPart(String name);
 }
index 8d466d7..98921de 100644 (file)
@@ -20,6 +20,7 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequestWrapper;
 
 import java.io.IOException;
+import java.util.Collection;
 import java.util.Enumeration;
 
 /**
@@ -292,7 +293,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public Iterable<Part> getParts() {
+    public Collection<Part> getParts() throws IOException, ServletException {
         return this._getHttpServletRequest().getParts();
     }
 
index 0a9bf62..9a14dc2 100644 (file)
@@ -17,6 +17,7 @@
 package javax.servlet.http;
 
 import java.io.IOException;
+import java.util.Collection;
 
 import javax.servlet.ServletResponse;
 
@@ -348,7 +349,7 @@ public interface HttpServletResponse extends ServletResponse {
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public Iterable<String> getHeaders(String name);
+    public Collection<String> getHeaders(String name);
 
     
     /**
@@ -357,7 +358,7 @@ public interface HttpServletResponse extends ServletResponse {
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public Iterable<String> getHeaderNames();
+    public Collection<String> getHeaderNames();
 
     
     /*
index f003e4b..285f561 100644 (file)
@@ -17,6 +17,7 @@
 package javax.servlet.http;
 
 import java.io.IOException;
+import java.util.Collection;
 
 import javax.servlet.ServletResponseWrapper;
 
@@ -218,7 +219,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper implement
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public Iterable<String> getHeaders(String name) {
+    public Collection<String> getHeaders(String name) {
         return this._getHttpServletResponse().getHeaders(name);
     }
 
@@ -226,7 +227,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper implement
      * @since Servlet 3.0
      * TODO SERVLET3 - Add comments
      */
-    public Iterable<String> getHeaderNames() {
+    public Collection<String> getHeaderNames() {
         return this._getHttpServletResponse().getHeaderNames();
     }
 
index 7f9ca50..087e621 100644 (file)
@@ -18,6 +18,7 @@ package javax.servlet.http;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Collection;
 
 /**
  * @since Servlet 3.0
@@ -31,6 +32,6 @@ public interface Part {
     public void write(String fileName) throws IOException;
     public void delete() throws IOException;
     public String getHeader(String name);
-    public Iterable<String> getHeaders(String name);
-    public Iterable<String> getHeaderNames();
+    public Collection<String> getHeaders(String name);
+    public Collection<String> getHeaderNames();
 }
index a43f9ef..42e0fe3 100644 (file)
@@ -26,6 +26,7 @@ import java.io.UnsupportedEncodingException;
 import java.security.Principal;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -36,7 +37,6 @@ import java.util.TreeMap;
 
 import javax.security.auth.Subject;
 import javax.servlet.AsyncContext;
-import javax.servlet.AsyncListener;
 import javax.servlet.DispatcherType;
 import javax.servlet.FilterChain;
 import javax.servlet.RequestDispatcher;
@@ -391,11 +391,6 @@ public class Request
      */
     protected volatile AsyncContextImpl asyncContext = null;
     
-    /**
-     * async timeout
-     */
-    protected long asyncTimeout = 0;
-    
     protected Boolean asyncSupported = null;
     
     
@@ -1501,37 +1496,6 @@ public class Request
         return this.asyncContext;
     }
 
-    public void addAsyncListener(AsyncListener listener) {
-        // TODO SERVLET3 - async
-        if (isAsyncSupported() && isAsyncStarted()) {
-            this.asyncContext.addAsyncListener(listener);
-        } else {
-            throw new IllegalStateException("Async [Supported:"+isAsyncSupported()+"; Started:"+isAsyncStarted()+"]");
-        }
-    }
-
-    public void addAsyncListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) {
-        // TODO SERVLET3 - async
-        if (isAsyncSupported() && isAsyncStarted()) {
-            this.asyncContext.addAsyncListener(listener,servletRequest,servletResponse);
-        } else {
-            throw new IllegalStateException("Async [Supported:"+isAsyncSupported()+"; Started:"+isAsyncStarted()+"]");
-        }
-    }
-
-    public void setAsyncTimeout(long timeout) {
-        // TODO SERVLET3 - async
-        if (this.asyncTimeout!=timeout) {
-            this.asyncTimeout = timeout;
-            coyoteRequest.action(ActionCode.ACTION_ASYNC_SETTIMEOUT,new Long(timeout));
-        }
-    }
-    
-    public long getAsyncTimeout() {
-        // TODO SERVLET3 - async
-        return asyncTimeout;
-    }
-    
     public DispatcherType getDispatcherType() {
         // TODO SERVLET3 - dispatcher
         if (internalDispatcherType==null) { 
@@ -2311,8 +2275,8 @@ public class Request
         // TODO Servlet 3 - authentication
     }
     
-    public Iterable<Part> getParts() {
-        // TODO Servlet 3 - authentication
+    public Collection<Part> getParts() {
+        // TODO Servlet 3 - file upload
         return null;
     }
     
index c82f371..a79b7e3 100644 (file)
@@ -22,12 +22,12 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.Map;
 
 import javax.servlet.AsyncContext;
-import javax.servlet.AsyncListener;
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletContext;
@@ -973,27 +973,10 @@ public class RequestFacade implements HttpServletRequest {
     }
 
     
-    public void addAsyncListener(AsyncListener listener) {
-        request.addAsyncListener(listener);
-    }
-
-    
-    public void addAsyncListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) {
-        request.addAsyncListener(listener,servletRequest,servletResponse);
-    }
-
     public AsyncContext getAsyncContext() {
         return request.getAsyncContext();
     }
 
-    public long getAsyncTimeout() {
-        return request.getAsyncTimeout();
-    }
-    
-    public void setAsyncTimeout(long timeout) {
-        request.setAsyncTimeout(timeout);
-    }
-    
     public DispatcherType getDispatcherType() {
         return request.getDispatcherType();
     }
@@ -1011,7 +994,7 @@ public class RequestFacade implements HttpServletRequest {
         request.logout();
     }
     
-    public Iterable<Part> getParts() {
+    public Collection<Part> getParts() {
         return request.getParts();
     }
     
index e0c26a2..9db6feb 100644 (file)
@@ -29,6 +29,7 @@ import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
@@ -876,7 +877,7 @@ public class Response
     /**
      * Return an Iterable of all the header names set for this response.
      */
-    public Iterable<String> getHeaderNames() {
+    public Collection<String> getHeaderNames() {
 
         MimeHeaders headers = coyoteResponse.getMimeHeaders();
         int n = headers.size();
@@ -895,7 +896,7 @@ public class Response
      *
      * @param name Header name to look up
      */
-    public Iterable<String> getHeaders(String name) {
+    public Collection<String> getHeaders(String name) {
 
         Enumeration<String> enumeration =
             coyoteResponse.getMimeHeaders().values(name);
index e687612..9c26b15 100644 (file)
@@ -24,6 +24,7 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.util.Collection;
 import java.util.Locale;
 
 import javax.servlet.ServletOutputStream;
@@ -561,11 +562,11 @@ public class ResponseFacade
         return response.getHeader(name);
     }
     
-    public Iterable<String> getHeaderNames() {
+    public Collection<String> getHeaderNames() {
         return response.getHeaderNames();
     }
     
-    public Iterable<String> getHeaders(String name) {
+    public Collection<String> getHeaders(String name) {
         return response.getHeaders(name);
     }
 }
index ed9d131..240762e 100644 (file)
@@ -26,6 +26,7 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.Enumeration;
+import java.util.EventListener;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
@@ -45,6 +46,7 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRegistration;
 import javax.servlet.SessionCookieConfig;
 import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
 
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
@@ -897,7 +899,7 @@ public class ApplicationContext
     }
 
 
-    public FilterRegistration findFilterRegistration(String filterName) {
+    public FilterRegistration getFilterRegistration(String filterName) {
         // TODO Servlet 3.0
         return null;
     }
@@ -967,7 +969,7 @@ public class ApplicationContext
     }
 
 
-    public ServletRegistration findServletRegistration(String servletName) {
+    public ServletRegistration getServletRegistration(String servletName) {
         // TODO Servlet 3.0
         return null;
     }
@@ -1062,12 +1064,87 @@ public class ApplicationContext
     }
 
 
+    @Override
     public boolean setInitParameter(String name, String value) {
         // TODO Servlet 3
         return false;
     }
     
     
+    @Override
+    public void addListener(Class<? extends EventListener> listenerClass) {
+        // TODO Servlet 3
+    }
+
+
+    @Override
+    public void addListener(String className) {
+        // TODO Servlet 3
+    }
+
+
+    @Override
+    public <T extends EventListener> void addListener(T t) {
+        // TODO Servlet 3
+    }
+
+
+    @Override
+    public <T extends EventListener> T createListener(Class<T> c)
+            throws ServletException {
+        // TODO Servlet 3
+        return null;
+    }
+
+
+    @Override
+    public void declareRoles(String... roleNames) {
+        // TODO Servlet 3
+    }
+
+
+    @Override
+    public ClassLoader getClassLoader() {
+        // TODO Servlet 3
+        return null;
+    }
+
+
+    @Override
+    public int getEffectiveMajorVersion() {
+        // TODO Servlet 3
+        return 0;
+    }
+
+
+    @Override
+    public int getEffectiveMinorVersion() {
+        // TODO Servlet 3
+        return 0;
+    }
+
+
+    @Override
+    public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+        // TODO Servlet 3
+        return null;
+    }
+
+
+    @Override
+    public JspConfigDescriptor getJspConfigDescriptor() {
+        // TODO Servlet 3
+        return null;
+    }
+
+
+    @Override
+    public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+        // TODO Servlet 3
+        return null;
+    }
+
+    
     // -------------------------------------------------------- Package Methods
     protected StandardContext getContext() {
         return this.context;
index a9d57ed..92f843d 100644 (file)
@@ -29,7 +29,9 @@ import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.EnumSet;
 import java.util.Enumeration;
+import java.util.EventListener;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
 
 import javax.servlet.Filter;
@@ -41,6 +43,7 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRegistration;
 import javax.servlet.SessionCookieConfig;
 import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
 
 import org.apache.catalina.Globals;
 import org.apache.catalina.security.SecurityUtil;
@@ -432,12 +435,12 @@ public final class ApplicationContextFacade
     }
 
 
-    public FilterRegistration findFilterRegistration(String filterName) {
+    public FilterRegistration getFilterRegistration(String filterName) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             return (FilterRegistration) doPrivileged(
                     "findFilterRegistration", new Object[]{filterName});
         } else {
-            return context.findFilterRegistration(filterName);
+            return context.getFilterRegistration(filterName);
         }
     }
     
@@ -486,12 +489,12 @@ public final class ApplicationContextFacade
     }
 
     
-    public ServletRegistration findServletRegistration(String servletName) {
+    public ServletRegistration getServletRegistration(String servletName) {
         if (SecurityUtil.isPackageProtectionEnabled()) {
             return (ServletRegistration) doPrivileged(
                     "findServletRegistration", new Object[]{servletName});
         } else {
-            return context.findServletRegistration(servletName);
+            return context.getServletRegistration(servletName);
         }
     }
     
@@ -545,8 +548,127 @@ public final class ApplicationContextFacade
             return context.setInitParameter(name, value);
         }
     }
-    
-    
+
+
+    @Override
+    public void addListener(Class<? extends EventListener> listenerClass) {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            doPrivileged("addListener",
+                    new Object[]{listenerClass});
+        } else {
+            context.addListener(listenerClass);
+        }
+    }
+
+
+    @Override
+    public void addListener(String className) {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            doPrivileged("addListener",
+                    new Object[]{className});
+        } else {
+            context.addListener(className);
+        }
+    }
+
+
+    @Override
+    public <T extends EventListener> void addListener(T t) {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            doPrivileged("addListener",
+                    new Object[]{t});
+        } else {
+            context.addListener(t);
+        }
+    }
+
+
+    @Override
+    public <T extends EventListener> T createListener(Class<T> c)
+            throws ServletException {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return (T) doPrivileged("createListener", new Object[]{c});
+        } else {
+            return context.createListener(c);
+        }
+    }
+
+
+    @Override
+    public void declareRoles(String... roleNames) {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            doPrivileged("declareRoles",
+                    new Object[]{roleNames});
+        } else {
+            context.declareRoles(roleNames);
+        }
+    }
+
+
+    @Override
+    public ClassLoader getClassLoader() {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return (ClassLoader) doPrivileged("getClassLoader", null);
+        } else {
+            return context.getClassLoader();
+        }
+    }
+
+
+    @Override
+    public int getEffectiveMajorVersion() {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return ((Integer) doPrivileged("getEffectiveMajorVersion",
+                    null)).intValue();
+        } else  {
+            return context.getEffectiveMajorVersion();
+        }
+    }
+
+
+    @Override
+    public int getEffectiveMinorVersion() {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return ((Integer) doPrivileged("getEffectiveMinorVersion",
+                    null)).intValue();
+        } else  {
+            return context.getEffectiveMinorVersion();
+        }
+    }
+
+
+    @Override
+    public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return (Map<String, ? extends FilterRegistration>) doPrivileged(
+                    "getFilterRegistrations", null);
+        } else {
+            return context.getFilterRegistrations();
+        }
+    }
+
+
+    @Override
+    public JspConfigDescriptor getJspConfigDescriptor() {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return (JspConfigDescriptor) doPrivileged("getJspConfigDescriptor",
+                    null);
+        } else {
+            return context.getJspConfigDescriptor();
+        }
+    }
+
+
+    @Override
+    public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+        if (SecurityUtil.isPackageProtectionEnabled()) {
+            return (Map<String, ? extends ServletRegistration>) doPrivileged(
+                    "getServletRegistrations", null);
+        } else {
+            return context.getServletRegistrations();
+        }
+    }
+
     /**
      * Use reflection to invoke the requested method. Cache the method object 
      * to speed up the process
@@ -669,4 +791,5 @@ public final class ApplicationContextFacade
         
         throw realException;
     }
+
 }
index e7dcfe9..aab357c 100644 (file)
@@ -194,18 +194,36 @@ public class AsyncContextImpl implements AsyncContext {
         }
     }
     
-    public void addAsyncListener(AsyncListener listener) {
+    @Override
+    public void addListener(AsyncListener listener) {
         AsyncListenerWrapper wrapper = new AsyncListenerWrapper();
         wrapper.setListener(listener);
         listeners.add(wrapper);
     }
 
-    public void addAsyncListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) {
+    @Override
+    public void addListener(AsyncListener listener, ServletRequest servletRequest,
+            ServletResponse servletResponse) {
         AsyncListenerWrapper wrapper = new AsyncListenerWrapper();
         wrapper.setListener(listener);
         listeners.add(wrapper);
     }
-    
+
+    @Override
+    public <T extends AsyncListener> T createListener(Class<T> clazz)
+            throws ServletException {
+        T listener = null;
+        try {
+             listener = clazz.newInstance();
+        } catch (InstantiationException e) {
+            ServletException se = new ServletException(e);
+            throw se;
+        } catch (IllegalAccessException e) {
+            ServletException se = new ServletException(e);
+            throw se;
+        }
+        return listener;
+    }
     
     public void recycle() {
         servletRequest = null;
@@ -341,11 +359,11 @@ public class AsyncContextImpl implements AsyncContext {
         state.set(st);
     }
     
-    public long getAsyncTimeout() {
+    public long getTimeout() {
         return timeout;
     }
     
-    public void setAsyncTimeout(long timeout) {
+    public void setTimeout(long timeout) {
         this.timeout = timeout;
         request.getCoyoteRequest().action(ActionCode.ACTION_ASYNC_SETTIMEOUT,new Long(timeout));
     }
@@ -361,7 +379,7 @@ public class AsyncContextImpl implements AsyncContext {
     public void init(ServletRequest request, ServletResponse response) {
         this.servletRequest = request;
         this.servletResponse = response;
-        event = new AsyncEvent(request,response); 
+        event = new AsyncEvent(this, request, response); 
     }
 
 }
index ebc5113..3c32ec4 100644 (file)
@@ -25,13 +25,13 @@ import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.Socket;
 import java.security.Principal;
+import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 
 import javax.servlet.AsyncContext;
-import javax.servlet.AsyncListener;
 import javax.servlet.DispatcherType;
 import javax.servlet.FilterChain;
 import javax.servlet.RequestDispatcher;
@@ -282,8 +282,6 @@ public class DummyRequest
     public String getLocalName() { return null; }
     public int getLocalPort() { return -1; }
     public int getRemotePort() { return -1; }
-    public void addAsyncListener(AsyncListener listener, ServletRequest req,
-            ServletResponse res) {}
     public ServletContext getServletContext() { return null; }
     public boolean isAsyncStarted() { return false; }
     public boolean isAsyncSupported() { return false; }
@@ -291,17 +289,14 @@ public class DummyRequest
         return null;
     }
     public Part getPart(String name) { return null; }
-    public Iterable<Part> getParts() { return null; }
+    public Collection<Part> getParts() { return null; }
     public boolean authenticate(HttpServletResponse response)
     throws IOException, ServletException { return false; }
     public void login(String username, String password)
     throws ServletException {}
     public void logout() throws ServletException {}
-    public void addAsyncListener(AsyncListener listener) {}
     public AsyncContext getAsyncContext() { return null; }
-    public long getAsyncTimeout() { return 0; }
     public DispatcherType getDispatcherType() { return null; }
-    public void setAsyncTimeout(long timeout) {}
     public AsyncContext startAsync(ServletRequest servletRequest,
             ServletResponse servletResponse) { return null; }
 }
index f871b6a..0d3d620 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.catalina.core;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintWriter;
+import java.util.Collection;
 import java.util.Locale;
 
 import javax.servlet.ServletOutputStream;
@@ -101,7 +102,7 @@ public class DummyResponse
 
     public Cookie[] getCookies() { return null; }
     public String getHeader(String name) { return null; }
-    public Iterable<String> getHeaderNames() { return null; }
+    public Collection<String> getHeaderNames() { return null; }
     public String[] getHeaderValues(@SuppressWarnings("unused") String name) {
         return null;
     }
@@ -130,5 +131,5 @@ public class DummyResponse
     public void setStatus(int status) {}
     /** @deprecated */
     public void setStatus(int status, String message) {}
-    public Iterable<String> getHeaders(String name) { return null; }
+    public Collection<String> getHeaders(String name) { return null; }
 }
index 998536b..2c85115 100644 (file)
@@ -25,8 +25,10 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.EnumSet;
 import java.util.Enumeration;
+import java.util.EventListener;
 import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
 
@@ -40,6 +42,7 @@ import javax.servlet.ServletRegistration;
 import javax.servlet.SessionCookieConfig;
 import javax.servlet.SessionTrackingMode;
 import javax.servlet.FilterRegistration.Dynamic;
+import javax.servlet.descriptor.JspConfigDescriptor;
 
 
 /**
@@ -512,12 +515,12 @@ public class JspCServletContext implements ServletContext {
     }
 
 
-    public FilterRegistration findFilterRegistration(String filterName) {
+    public FilterRegistration getFilterRegistration(String filterName) {
         return null;
     }
 
 
-    public ServletRegistration findServletRegistration(String servletName) {
+    public ServletRegistration getServletRegistration(String servletName) {
         return null;
     }
 
@@ -526,4 +529,71 @@ public class JspCServletContext implements ServletContext {
         return false;
     }
 
+
+    @Override
+    public void addListener(Class<? extends EventListener> listenerClass) {
+        // NOOP
+    }
+
+
+    @Override
+    public void addListener(String className) {
+        // NOOP
+    }
+
+
+    @Override
+    public <T extends EventListener> void addListener(T t) {
+        // NOOP
+    }
+
+
+    @Override
+    public <T extends EventListener> T createListener(Class<T> c)
+            throws ServletException {
+        return null;
+    }
+
+
+    @Override
+    public void declareRoles(String... roleNames) {
+        // NOOP
+    }
+
+
+    @Override
+    public ClassLoader getClassLoader() {
+        return null;
+    }
+
+
+    @Override
+    public int getEffectiveMajorVersion() {
+        return 3;
+    }
+
+
+    @Override
+    public int getEffectiveMinorVersion() {
+        return 0;
+    }
+
+
+    @Override
+    public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+        return null;
+    }
+
+
+    @Override
+    public JspConfigDescriptor getJspConfigDescriptor() {
+        return null;
+    }
+
+
+    @Override
+    public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+        return null;
+    }
+
 }
index 6929141..9ad05b5 100644 (file)
@@ -42,7 +42,7 @@ public class Async0 extends HttpServlet {
         } else {
             resp.setContentType("text/plain");
             final AsyncContext actx = req.startAsync();
-            actx.setAsyncTimeout(Long.MAX_VALUE);
+            actx.setTimeout(Long.MAX_VALUE);
             Runnable run = new Runnable() {
                 public void run() {
                     try {
index 497bfb2..b8fbc40 100644 (file)
@@ -35,7 +35,7 @@ public class Async1 extends HttpServlet {
     @Override
     protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         final AsyncContext actx = req.startAsync();
-        actx.setAsyncTimeout(30*1000);
+        actx.setTimeout(30*1000);
         Runnable run = new Runnable() {
             public void run() {
                 try {
index 0ef07ad..874fe42 100644 (file)
@@ -35,7 +35,7 @@ public class Async2 extends HttpServlet {
     @Override
     protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         final AsyncContext actx = req.startAsync();
-        actx.setAsyncTimeout(30*1000);
+        actx.setTimeout(30*1000);
         Runnable run = new Runnable() {
             public void run() {
                 try {
index 1d4a7e1..c4a8596 100644 (file)
@@ -35,7 +35,7 @@ public class Async3 extends HttpServlet {
     @Override
     protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         final AsyncContext actx = req.startAsync();
-        actx.setAsyncTimeout(30*1000);
+        actx.setTimeout(30*1000);
         actx.dispatch("/jsp/async/async3.jsp");
         actx.complete();
     }