Author: remy.maucherat(a)jboss.com
Date: 2009-04-19 13:17:15 -0400 (Sun, 19 Apr 2009)
New Revision: 1017
Added:
trunk/java/javax/servlet/annotation/MultipartConfig.java
trunk/java/javax/servlet/http/Part.java
Modified:
trunk/ROADMAP.txt
trunk/java/javax/servlet/AsyncContext.java
trunk/java/javax/servlet/AsyncEvent.java
trunk/java/javax/servlet/AsyncListener.java
trunk/java/javax/servlet/DispatcherType.java
trunk/java/javax/servlet/FilterChain.java
trunk/java/javax/servlet/FilterRegistration.java
trunk/java/javax/servlet/Registration.java
trunk/java/javax/servlet/ServletContainerInitializer.java
trunk/java/javax/servlet/ServletContext.java
trunk/java/javax/servlet/ServletContextAttributeEvent.java
trunk/java/javax/servlet/ServletContextAttributeListener.java
trunk/java/javax/servlet/ServletContextEvent.java
trunk/java/javax/servlet/ServletContextListener.java
trunk/java/javax/servlet/ServletRegistration.java
trunk/java/javax/servlet/ServletRequest.java
trunk/java/javax/servlet/ServletRequestAttributeEvent.java
trunk/java/javax/servlet/ServletRequestEvent.java
trunk/java/javax/servlet/ServletRequestWrapper.java
trunk/java/javax/servlet/ServletResponse.java
trunk/java/javax/servlet/ServletResponseWrapper.java
trunk/java/javax/servlet/SessionCookieConfig.java
trunk/java/javax/servlet/SessionTrackingMode.java
trunk/java/javax/servlet/annotation/HandlesTypes.java
trunk/java/javax/servlet/annotation/WebFilter.java
trunk/java/javax/servlet/annotation/WebServlet.java
trunk/java/javax/servlet/http/Cookie.java
trunk/java/javax/servlet/http/HttpServletRequest.java
trunk/java/javax/servlet/http/HttpServletRequestWrapper.java
trunk/java/javax/servlet/http/HttpServletResponse.java
trunk/java/javax/servlet/http/HttpServletResponseWrapper.java
trunk/java/javax/servlet/http/HttpSession.java
trunk/java/javax/servlet/http/HttpSessionActivationListener.java
trunk/java/javax/servlet/http/HttpSessionAttributeListener.java
trunk/java/javax/servlet/http/HttpSessionBindingEvent.java
trunk/java/javax/servlet/http/HttpSessionEvent.java
trunk/java/javax/servlet/http/HttpSessionListener.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/RequestFacade.java
trunk/java/org/apache/catalina/core/ClassLoadingAnnotationScanner.java
trunk/java/org/apache/catalina/core/DummyRequest.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/java/org/apache/catalina/startup/TldConfig.java
trunk/java/org/apache/tomcat/util/http/fileupload/DefaultFileItem.java
trunk/java/org/apache/tomcat/util/http/fileupload/DefaultFileItemFactory.java
trunk/java/org/apache/tomcat/util/http/fileupload/DiskFileUpload.java
trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java
trunk/java/org/apache/tomcat/util/http/fileupload/FileItemFactory.java
trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadException.java
Log:
- Sync with API snapshot.
- The return types are not ok right now, so it won't build.
- Add the Part API to fileupload.
- Start refactoring TldConfig.
Modified: trunk/ROADMAP.txt
===================================================================
--- trunk/ROADMAP.txt 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/ROADMAP.txt 2009-04-19 17:17:15 UTC (rev 1017)
@@ -16,7 +16,7 @@
Other:
- Diagnostic and monitoring features (provided by the jopr/JON agent, as JBoss Web
standalone seems too
- lightweight for embeddede jopr/JON to make sense)
+ lightweight for embedded jopr/JON to make sense)
- .net support like the php support (looks ok, but PHP is hard to use, how would this be
different ?)
- fastcgi servlet (sounds useless)
- Java proxy (probably too many components needed to compete with mod_cluster, but a very
basic HTTP proxy could be useful
Modified: trunk/java/javax/servlet/AsyncContext.java
===================================================================
--- trunk/java/javax/servlet/AsyncContext.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/AsyncContext.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -46,7 +46,7 @@
* Repeated invocations of these methods will return the same AsyncContext
* instance, reinitialized as appropriate.
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public interface AsyncContext {
Modified: trunk/java/javax/servlet/AsyncEvent.java
===================================================================
--- trunk/java/javax/servlet/AsyncEvent.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/AsyncEvent.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -42,7 +42,7 @@
* processing was started has finished processing through a call to
* {@link AsyncContext#complete} or has timed out.
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public class AsyncEvent {
Modified: trunk/java/javax/servlet/AsyncListener.java
===================================================================
--- trunk/java/javax/servlet/AsyncListener.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/AsyncListener.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -46,7 +46,7 @@
* or {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}
* completes or times out.
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public interface AsyncListener extends EventListener {
Modified: trunk/java/javax/servlet/DispatcherType.java
===================================================================
--- trunk/java/javax/servlet/DispatcherType.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/DispatcherType.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -28,6 +28,8 @@
/**
* Enumeration of filter dispatcher types.
+ *
+ * @since Servlet 3.0
*/
public enum DispatcherType {
FORWARD,
Modified: trunk/java/javax/servlet/FilterChain.java
===================================================================
--- trunk/java/javax/servlet/FilterChain.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/FilterChain.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -52,8 +52,6 @@
* limitations under the License.
*/
-
-
package javax.servlet;
import java.io.IOException;
@@ -76,8 +74,6 @@
*
* @param request the request to pass along the chain.
* @param response the response to pass along the chain.
- *
- * @since 2.3
*/
public void doFilter ( ServletRequest request, ServletResponse response ) throws
IOException, ServletException;
Modified: trunk/java/javax/servlet/FilterRegistration.java
===================================================================
--- trunk/java/javax/servlet/FilterRegistration.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/FilterRegistration.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -41,7 +41,7 @@
/**
* Interface through which a {@link Filter} may be further configured.
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public interface FilterRegistration extends Registration {
@@ -65,14 +65,12 @@
* from which this FilterRegistration was obtained
* @param servletNames the servlet names of the filter mapping
*
- * @return true if the update was successful, false otherwise
- *
* @throws IllegalArgumentException if <tt>servletNames</tt> is null or
* empty
* @throws IllegalStateException if the ServletContext from which this
* FilterRegistration was obtained has already been initialized
*/
- public boolean addMappingForServletNames(
+ public void addMappingForServletNames(
EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
String... servletNames);
@@ -96,14 +94,12 @@
* from which this FilterRegistration was obtained
* @param urlPatterns the url patterns of the filter mapping
*
- * @return true if the update was successful, false otherwise
- *
* @throws IllegalArgumentException if <tt>urlPatterns</tt> is null or
* empty
* @throws IllegalStateException if the ServletContext from which this
* FilterRegistration was obtained has already been initialized
*/
- public boolean addMappingForUrlPatterns(
+ public void addMappingForUrlPatterns(
EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
String... urlPatterns);
Modified: trunk/java/javax/servlet/Registration.java
===================================================================
--- trunk/java/javax/servlet/Registration.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/Registration.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -37,12 +37,13 @@
package javax.servlet;
import java.util.Map;
+import java.util.Set;
/**
* Interface through which a {@link Servlet} or {@link Filter} may be
* further configured.
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public interface Registration {
@@ -80,14 +81,15 @@
*
* @param initParameters the initialization parameters
*
- * @return true if the update was successful, false otherwise
+ * @return the (possibly empty) Set of initialization parameter names
+ * that are in conflict
*
* @throws IllegalStateException if the ServletContext from which this
* Registration was obtained has already been initialized
* @throws IllegalArgumentException if the given map contains an
* initialization parameter with a <tt>null</tt> name or value
*/
- public boolean setInitParameters(Map<String, String> initParameters);
+ public Set<String> setInitParameters(Map<String, String>
initParameters);
/**
* Interface through which a {@link Servlet} or {@link Filter} registered
Modified: trunk/java/javax/servlet/ServletContainerInitializer.java
===================================================================
--- trunk/java/javax/servlet/ServletContainerInitializer.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/ServletContainerInitializer.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -35,10 +35,8 @@
*
*/
-
package javax.servlet;
-
import java.util.Set;
/**
@@ -51,19 +49,17 @@
*
* @see javax.servlet.annotation.HandlesTypes
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public interface ServletContainerInitializer {
+
/**
- *
* @param c The set of classes that an implementation of ServletContainerInitializer
expressed interest on
* via the <tt>HandlesTypes</tt> annotation. If there is no
<tt>HandlesTypes</tt> annotation on the implementation
* of the ServletContainerInitializer, a <tt>null</tt> set of classes
will be passed
*
* @param ctx The <tt>ServletContext</tt> instance in which the types
defined via the <tt>HandlesTypes</tt>
* are found.
- *
- * @since 3.0
*/
public void onStartup(Set<Class<?>> c, ServletContext ctx);
}
Modified: trunk/java/javax/servlet/ServletContext.java
===================================================================
--- trunk/java/javax/servlet/ServletContext.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/ServletContext.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -103,9 +103,9 @@
*
* <p>The context path is the portion of the request URI that is used
* to select the context of the request. The context path always comes
- * first in a request URI. The path starts with a "/" character but does
- * not end with a "/" character. For servlets in the default (root)
- * context, this method returns "".
+ * first in a request URI. The path starts with a <tt>/</tt> character
+ * but does not end with a <tt>/</tt> character. For servlets in the
+ * default (root) context, this method returns "".
*
* <p>It is possible that a servlet container may match a context by
* more than one context path. In such cases the
@@ -120,7 +120,7 @@
*
* @see javax.servlet.http.HttpServletRequest#getContextPath()
*
- * @since 2.5
+ * @since Servlet 2.5
*/
public String getContextPath();
@@ -132,7 +132,7 @@
* <p>This method allows servlets to gain
* access to the context for various parts of the server, and as
* needed obtain {@link RequestDispatcher} objects from the context.
- * The given path must be begin with "/", is interpreted relative
+ * The given path must be begin with <tt>/</tt>, is interpreted relative
* to the server's document root and is matched against the context
* roots of other web applications hosted on this container.
*
@@ -176,9 +176,8 @@
* the MIME type is not known. The MIME type is determined
* by the configuration of the servlet container, and may be specified
* in a web application deployment descriptor. Common MIME
- * types are <code>"text/html"</code> and
<code>"image/gif"</code>.
+ * types include <code>text/html</code> and
<code>image/gif</code>.
*
- *
* @param file a <code>String</code> specifying the name of a file
*
* @return a <code>String</code> specifying the file's MIME type
@@ -191,43 +190,58 @@
* within the web application whose longest sub-path matches the
* supplied path argument.
*
- * Paths indicating subdirectory paths end with a '/'.
+ * <p>Paths indicating subdirectory paths end with a <tt>/</tt>.
*
- * The returned paths are all relative to the root of the web application
- * and have a leading '/'.
+ * <p>The returned paths are all relative to the root of the web
+ * application, or relative to the <tt>/META-INF/resources</tt>
+ * directory of a JAR file inside the web application's
+ * <tt>/WEB-INF/lib</tt> directory, and have a leading
<tt>/</tt>.
*
- * For example, for a web application containing<br><br>
+ * <p>For example, for a web application containing:
*
- * /welcome.html<br>
- * /catalog/index.html<br>
- * /catalog/products.html<br>
- * /catalog/offers/books.html<br>
- * /catalog/offers/music.html<br>
- * /customer/login.jsp<br>
- * /WEB-INF/web.xml<br>
- * /WEB-INF/classes/com.acme.OrderServlet.class,<br><br>
- *
- * getResourcePaths("/") returns {"/welcome.html",
"/catalog/",
- * "/customer/", "/WEB-INF/"}<br>
- * getResourcePaths("/catalog/") returns {"/catalog/index.html",
- * "/catalog/products.html", "/catalog/offers/"}.<br>
+ * <code><pre>
+ * /welcome.html
+ * /catalog/index.html
+ * /catalog/products.html
+ * /catalog/offers/books.html
+ * /catalog/offers/music.html
+ * /customer/login.jsp
+ * /WEB-INF/web.xml
+ * /WEB-INF/classes/com.acme.OrderServlet.class
+ * /WEB-INF/lib/catalog.jar!/META-INF/resources/catalog/moreOffers/books.html
+ * </pre></code>
*
- * @param path the partial path used to match the resources,
- * which must start with a /
+ * <tt>getResourcePaths("/")</tt> would return
+ * <tt>{"/welcome.html", "/catalog/",
"/customer/", "/WEB-INF/"}</tt>,
+ * and <tt>getResourcePaths("/catalog/")</tt> would return
+ * <tt>{"/catalog/index.html", "/catalog/products.html",
+ * "/catalog/offers/", "/catalog/moreOffers/"}</tt>.
+ *
+ * @param path the partial path used to match the resources,
+ * which must start with a <tt>/</tt>
* @return a Set containing the directory listing, or null if there
* are no resources in the web application whose path
* begins with the supplied path.
*
- * @since 2.3
+ * @since Servlet 2.3
*/
public Set<String> getResourcePaths(String path);
/**
- * Returns a URL to the resource that is mapped to a specified
- * path. The path must begin with a "/" and is interpreted
- * as relative to the current context root.
+ * Returns a URL to the resource that is mapped to the given path.
*
+ * <p>The path must begin with a <tt>/</tt> and is interpreted
+ * as relative to the current context root,
+ * or relative to the <tt>/META-INF/resources</tt> directory
+ * of a JAR file inside the web application's <tt>/WEB-INF/lib</tt>
+ * directory.
+ * This method will first search the document root of the
+ * web application for the requested resource, before searching
+ * any of the JAR files inside <tt>/WEB-INF/lib</tt>.
+ * The order in which the JAR files inside <tt>/WEB-INF/lib</tt>
+ * are searched is undefined.
+ *
* <p>This method allows the servlet container to make a resource
* available to servlets from any source. Resources
* can be located on a local or remote
@@ -308,12 +322,15 @@
* a request to the resource or to include the resource in a response.
* The resource can be dynamic or static.
*
- * <p>The pathname must begin with a "/" and is interpreted as
relative
- * to the current context root. Use <code>getContext</code> to obtain
- * a <code>RequestDispatcher</code> for resources in foreign contexts.
- * This method returns <code>null</code> if the
<code>ServletContext</code>
- * cannot return a <code>RequestDispatcher</code>.
+ * <p>The pathname must begin with a <tt>/</tt> and is interpreted
as
+ * relative to the current context root. Use <code>getContext</code>
+ * to obtain a <code>RequestDispatcher</code> for resources in foreign
+ * contexts.
*
+ * <p>This method returns <code>null</code> if the
+ * <code>ServletContext</code> cannot return a
+ * <code>RequestDispatcher</code>.
+ *
* @param path a <code>String</code> specifying the pathname
* to the resource
*
@@ -440,26 +457,36 @@
/**
- * Returns a <code>String</code> containing the real path
- * for a given virtual path. For example, the path "/index.html"
- * returns the absolute file path on the server's filesystem would be
- * served by a request for "http://host/contextPath/index.html",
- * where contextPath is the context path of this ServletContext..
+ * Gets the <i>real</i> path corresponding to the given
+ * <i>virtual</i> path.
*
+ * <p>For example, if <tt>path</tt> is equal to
<tt>/index.html</tt>,
+ * this method will return the absolute file path on the server's
+ * filesystem to which a request of the form
+ *
<tt>http://<host>:<port>/<contextPath>/index.html</tt>
+ * would be mapped, where <tt><contextPath></tt>
corresponds to the
+ * context path of this ServletContext.
+ *
* <p>The real path returned will be in a form
* appropriate to the computer and operating system on
* which the servlet container is running, including the
- * proper path separators. This method returns <code>null</code>
- * if the servlet container cannot translate the virtual path
- * to a real path for any reason (such as when the content is
- * being made available from a <code>.war</code> archive).
+ * proper path separators.
+ * Paths to resources located inside the <tt>/META-INF/resources</tt>
+ * directory of a JAR file inside the application's
<tt>/WEB-INF/lib</tt>
+ * directory are returned using this format:
+ *
<tt><absolute-file-path-on-disk>/WEB-INF/lib/<name-of-jar>!/META-INF/resources/<path></tt>,
+ * where <tt><path></tt> corresponds to the
<tt>path</tt>
+ * argument passed to this method.
*
+ * <p>This method returns <code>null</code> if the servlet
container
+ * is unable to translate the given <i>virtual</i> path to a
+ * <i>real</i> path.
*
- * @param path a <code>String</code> specifying a virtual path
+ * @param path the <i>virtual</i> path to be translated to a
+ * <i>real</i> path
*
- *
- * @return a <code>String</code> specifying the real path,
- * or null if the translation cannot be performed
+ * @return the <i>real</i> path, or <tt>null</tt> if the
+ * translation cannot be performed
*/
public String getRealPath(String path);
@@ -490,7 +517,7 @@
* parameter does not exist.
*
* <p>This method can make available configuration information useful
- * to an entire "web application". For example, it can provide a
+ * to an entire web application. For example, it can provide a
* webmaster's email address or the name of a system that holds
* critical data.
*
@@ -534,7 +561,7 @@
* @throws IllegalStateException if this ServletContext has already
* been initialized
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean setInitParameter(String name, String value);
@@ -542,7 +569,8 @@
/**
* Returns the servlet container attribute with the given name,
* or <code>null</code> if there is no attribute by that name.
- * An attribute allows a servlet container to give the
+ *
+ * <p>An attribute allows a servlet container to give the
* servlet additional information not
* already provided by this interface. See your
* server documentation for information about its attributes.
@@ -551,12 +579,12 @@
*
* <p>The attribute is returned as a <code>java.lang.Object</code>
* or some subclass.
- * Attribute names should follow the same convention as package
+ *
+ * <p>Attribute names should follow the same convention as package
* names. The Java Servlet API specification reserves names
* matching <code>java.*</code>, <code>javax.*</code>,
* and <code>sun.*</code>.
*
- *
* @param name a <code>String</code> specifying the name
* of the attribute
*
@@ -600,7 +628,6 @@
* matching <code>java.*</code>, <code>javax.*</code>, and
* <code>sun.*</code>.
*
- *
* @param name a <code>String</code> specifying the name
* of the attribute
*
@@ -619,8 +646,6 @@
* <p>If listeners are configured on the
<code>ServletContext</code> the
* container notifies them accordingly.
*
- *
- *
* @param name a <code>String</code> specifying the name
* of the attribute to be removed
*/
@@ -632,11 +657,10 @@
* ServletContext as specified in the deployment descriptor for this
* web application by the display-name element.
*
- *
* @return The name of the web application or null if no name has been
* declared in the deployment descriptor.
*
- * @since 2.3
+ * @since Servlet 2.3
*/
public String getServletContextName();
@@ -661,7 +685,7 @@
* @throws IllegalStateException if this ServletContext has already
* been initialized
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public ServletRegistration.Dynamic addServlet(
String servletName, String className);
@@ -688,7 +712,7 @@
* @throws IllegalArgumentException if the given servlet instance
* implements {@link SingleThreadModel}
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public ServletRegistration.Dynamic addServlet(
String servletName, Servlet servlet);
@@ -711,7 +735,7 @@
* @throws IllegalStateException if this ServletContext has already
* been initialized
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public ServletRegistration.Dynamic addServlet(String servletName,
Class <? extends Servlet> servletClass);
@@ -733,7 +757,7 @@
* @throws ServletException if an error occurs during the instantiation
* of, or resource injection into the new Servlet
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public <T extends Servlet> T createServlet(Class<T> c)
throws ServletException;
@@ -747,7 +771,7 @@
* given <tt>servletName</tt>, or null if no ServletRegistration exists
* under that name in this ServletContext
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public ServletRegistration findServletRegistration(String servletName);
@@ -772,7 +796,7 @@
* @throws IllegalStateException if this ServletContext has already
* been initialized
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public FilterRegistration.Dynamic addFilter(
String filterName, String className);
@@ -797,7 +821,7 @@
* @throws IllegalStateException if this ServletContext has already
* been initialized
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public FilterRegistration.Dynamic addFilter(
String filterName, Filter filter);
@@ -820,7 +844,7 @@
* @throws IllegalStateException if this ServletContext has already
* been initialized
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public FilterRegistration.Dynamic addFilter(String filterName,
Class <? extends Filter> filterClass);
@@ -842,7 +866,7 @@
* @throws ServletException if an error occurs during the instantiation
* of, or resource injection into the new Filter
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public <T extends Filter> T createFilter(Class<T> c)
throws ServletException;
@@ -856,7 +880,7 @@
* given <tt>filterName</tt>, or null if no FilterRegistration exists
* under that name in this ServletContext
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public FilterRegistration findFilterRegistration(String filterName);
@@ -873,7 +897,7 @@
* various properties of the session tracking cookies created on
* behalf of this <tt>ServletContext</tt> may be configured
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public SessionCookieConfig getSessionCookieConfig();
@@ -898,7 +922,7 @@
* or if <tt>sessionTrackingModes</tt> specifies a session tracking mode
* that is not supported by the servlet container
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public void setSessionTrackingModes(Set<SessionTrackingMode>
sessionTrackingModes);
@@ -910,7 +934,7 @@
* @return set of the session tracking modes supported by default for
* this <tt>ServletContext</tt>
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public Set<SessionTrackingMode> getDefaultSessionTrackingModes();
@@ -929,7 +953,7 @@
* @return set of the session tracking modes in effect for this
* <tt>ServletContext</tt>
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes();
Modified: trunk/java/javax/servlet/ServletContextAttributeEvent.java
===================================================================
--- trunk/java/javax/servlet/ServletContextAttributeEvent.java 2009-04-17 12:02:55 UTC
(rev 1016)
+++ trunk/java/javax/servlet/ServletContextAttributeEvent.java 2009-04-19 17:17:15 UTC
(rev 1017)
@@ -52,49 +52,58 @@
* limitations under the License.
*/
-
-
package javax.servlet;
+/**
+ * Event class for notifications about changes to the attributes of
+ * the ServletContext of a web application.
+ *
+ * @see ServletContextAttributeListener
+ *
+ * @since Servlet 2.3
+ */
- /**
- * This is the event class for notifications about changes to the attributes of the
- * servlet context of a web application.
- * @see ServletContextAttributeListener
- * @since v 2.3
- */
-
public class ServletContextAttributeEvent extends ServletContextEvent {
- private String name;
- private Object value;
- /** Construct a ServletContextAttributeEvent from the given context for the
- ** given attribute name and attribute value.
- */
- public ServletContextAttributeEvent(ServletContext source, String name, Object value) {
- super(source);
- this.name = name;
- this.value = value;
- }
+ private String name;
+ private Object value;
+
+ /**
+ * Constructs a ServletContextAttributeEvent from the given
+ * ServletContext, attribute name, and attribute value.
+ *
+ * @param source the ServletContext whose attribute changed
+ * @param name the name of the ServletContext attribute that changed
+ * @param value the value of the ServletContext attribute that changed
+ */
+ public ServletContextAttributeEvent(ServletContext source,
+ String name, Object value) {
+ super(source);
+ this.name = name;
+ this.value = value;
+ }
- /**
- * Return the name of the attribute that changed on the ServletContext.
- *
- */
- public String getName() {
- return this.name;
- }
+ /**
+ * Gets the name of the ServletContext attribute that changed.
+ *
+ * @return the name of the ServletContext attribute that changed
+ */
+ public String getName() {
+ return this.name;
+ }
- /**
- * Returns the value of the attribute that has been added, removed, or replaced.
- * If the attribute was added, this is the value of the attribute. If the attribute was
- * removed, this is the value of the removed attribute. If the attribute was replaced,
this
- * is the old value of the attribute.
- *
- */
-
- public Object getValue() {
- return this.value;
- }
+ /**
+ * Gets the value of the ServletContext attribute that changed.
+ *
+ * <p>If the attribute was added, this is the value of the attribute.
+ * If the attribute was removed, this is the value of the removed
+ * attribute. If the attribute was replaced, this is the old value of
+ * the attribute.
+ *
+ * @return the value of the ServletContext attribute that changed
+ */
+ public Object getValue() {
+ return this.value;
+ }
}
Modified: trunk/java/javax/servlet/ServletContextAttributeListener.java
===================================================================
--- trunk/java/javax/servlet/ServletContextAttributeListener.java 2009-04-17 12:02:55 UTC
(rev 1016)
+++ trunk/java/javax/servlet/ServletContextAttributeListener.java 2009-04-19 17:17:15 UTC
(rev 1017)
@@ -61,7 +61,7 @@
* To receive notification events, the implementation class
* must be configured in the deployment descriptor for the web application.
* @see ServletContextAttributeEvent
- * @since v 2.3
+ * @since Servlet 2.3
*/
public interface ServletContextAttributeListener extends EventListener {
Modified: trunk/java/javax/servlet/ServletContextEvent.java
===================================================================
--- trunk/java/javax/servlet/ServletContextEvent.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/ServletContextEvent.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -61,7 +61,8 @@
* This is the event class for notifications about changes to
* the servlet context of a web application.
* @see ServletContextListener
- * @since v 2.3
+ *
+ * @since Servlet 2.3
*/
public class ServletContextEvent extends java.util.EventObject {
Modified: trunk/java/javax/servlet/ServletContextListener.java
===================================================================
--- trunk/java/javax/servlet/ServletContextListener.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/ServletContextListener.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -66,7 +66,8 @@
* must be configured in the deployment descriptor for the web
* application.
* @see ServletContextEvent
- * @since v 2.3
+ *
+ * @since Servlet 2.3
*/
public interface ServletContextListener extends EventListener {
Modified: trunk/java/javax/servlet/ServletRegistration.java
===================================================================
--- trunk/java/javax/servlet/ServletRegistration.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/ServletRegistration.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -36,10 +36,12 @@
package javax.servlet;
+import java.util.*;
+
/**
* Interface through which a {@link Servlet} may be further configured.
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public interface ServletRegistration extends Registration {
@@ -47,16 +49,20 @@
* Adds a servlet mapping with the given URL patterns for the Servlet
* represented by this ServletRegistration.
*
+ * <p>If any of the specified URL patterns are already mapped to a
+ * different Servlet, no updates will be performed.
+ *
* @param urlPatterns the URL patterns of the servlet mapping
*
- * @return true if the update was successful, false otherwise
+ * @return the (possibly empty) Set of URL patterns that are already
+ * mapped to a different Servlet
*
* @throws IllegalArgumentException if <tt>urlPatterns</tt> is null
* or empty
* @throws IllegalStateException if the ServletContext from which this
* ServletRegistration was obtained has already been initialized
*/
- public boolean addMapping(String... urlPatterns);
+ public Set<String> addMapping(String... urlPatterns);
/**
* Interface through which a {@link Servlet} registered via one of the
Modified: trunk/java/javax/servlet/ServletRequest.java
===================================================================
--- trunk/java/javax/servlet/ServletRequest.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/ServletRequest.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -557,7 +557,7 @@
*
* @return an integer specifying the port number
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public int getRemotePort();
@@ -569,7 +569,7 @@
* @return a <code>String</code> containing the host
* name of the IP on which the request was received.
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public String getLocalName();
@@ -581,7 +581,7 @@
* @return a <code>String</code> containing the
* IP address on which the request was received.
*
- * @since 2.4
+ * @since Servlet 2.4
*
*/
public String getLocalAddr();
@@ -593,7 +593,7 @@
*
* @return an integer specifying the port number
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public int getLocalPort();
@@ -605,7 +605,7 @@
* @return the servlet context to which this servlet request was last
* dispatched
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public ServletContext getServletContext();
@@ -651,7 +651,7 @@
* {@link AsyncContext#dispatch}, or if the response has already been
* closed
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public AsyncContext startAsync() throws IllegalStateException;
@@ -719,7 +719,7 @@
* {@link AsyncContext#dispatch}, or if the response has already been
* closed
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public AsyncContext startAsync(ServletRequest servletRequest,
ServletResponse servletResponse)
@@ -733,14 +733,15 @@
* {@link #startAsync} or
* {@link #startAsync(ServletRequest,ServletResponse)} on it.
*
- * <p>If this request has been dispatched using one of the
- * {@link AsyncContext#dispatch} methods since it was put into
- * asynchronous mode, this method returns <tt>false</tt>.
+ * <p>This method returns <tt>false</tt> if this request was
+ * put into asynchronous mode, but has since been dispatched using
+ * one of the {@link AsyncContext#dispatch} methods or released
+ * from asynchronous mode via a call to {@link AsyncContext#complete}.
*
* @return true if this request has been put into asynchronous mode,
* false otherwise
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean isAsyncStarted();
@@ -756,7 +757,7 @@
* @return true if this request supports asynchronous operation, false
* otherwise
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean isAsyncSupported();
@@ -775,7 +776,7 @@
* into asynchronous mode, i.e., if neither {@link #startAsync} nor
* {@link #startAsync(ServletRequest,ServletResponse)} has been called
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public AsyncContext getAsyncContext();
@@ -797,7 +798,7 @@
*
* @param listener the AsyncListener to be registered
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public void addAsyncListener(AsyncListener listener);
@@ -831,7 +832,7 @@
* @param servletResponse the ServletResponse that will be included
* in the AsyncEvent
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public void addAsyncListener(AsyncListener listener,
ServletRequest servletRequest,
@@ -872,7 +873,7 @@
* unless within the scope of a dispatch resulting from an
* {@link AsyncContext#dispatch}
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public void setAsyncTimeout(long timeout);
@@ -892,7 +893,7 @@
* @return the timeout in milliseconds for any asynchronous
* operations started on this request
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public long getAsyncTimeout();
@@ -926,7 +927,7 @@
*
* @see DispatcherType
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public DispatcherType getDispatcherType();
}
Modified: trunk/java/javax/servlet/ServletRequestAttributeEvent.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestAttributeEvent.java 2009-04-17 12:02:55 UTC
(rev 1016)
+++ trunk/java/javax/servlet/ServletRequestAttributeEvent.java 2009-04-19 17:17:15 UTC
(rev 1017)
@@ -61,7 +61,7 @@
* This is the event class for notifications of changes to the
* attributes of the servlet request in an application.
* @see ServletRequestAttributeListener
- * @since Servlet 2.4
+ * @since Servlet 2.4
*/
public class ServletRequestAttributeEvent extends ServletRequestEvent {
Modified: trunk/java/javax/servlet/ServletRequestEvent.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestEvent.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/ServletRequestEvent.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -63,7 +63,7 @@
* The source of the event
* is the ServletContext of this web application.
* @see ServletRequestListener
- * @since Servlet 2.4
+ * @since Servlet 2.4
*/
public class ServletRequestEvent extends java.util.EventObject {
Modified: trunk/java/javax/servlet/ServletRequestWrapper.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestWrapper.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/ServletRequestWrapper.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -69,7 +69,7 @@
*
* @see javax.servlet.ServletRequest
*
- * @since 2.3
+ * @since Servlet 2.3
*/
public class ServletRequestWrapper implements ServletRequest {
@@ -341,7 +341,7 @@
* The default behavior of this method is to return
* getRemotePort() on the wrapped request object.
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public int getRemotePort(){
return this.request.getRemotePort();
@@ -352,7 +352,7 @@
* The default behavior of this method is to return
* getLocalName() on the wrapped request object.
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public String getLocalName(){
return this.request.getLocalName();
@@ -363,7 +363,7 @@
* The default behavior of this method is to return
* getLocalAddr() on the wrapped request object.
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public String getLocalAddr(){
return this.request.getLocalAddr();
@@ -374,7 +374,7 @@
* The default behavior of this method is to return
* getLocalPort() on the wrapped request object.
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public int getLocalPort(){
return this.request.getLocalPort();
@@ -388,7 +388,7 @@
* @return the servlet context to which the wrapped servlet request was
* last dispatched
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public ServletContext getServletContext() {
return request.getServletContext();
@@ -412,7 +412,7 @@
*
* @see ServletRequest#startAsync
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public AsyncContext startAsync() throws IllegalStateException {
return request.startAsync();
@@ -441,7 +441,7 @@
*
* @see ServletRequest#startAsync(ServletRequest, ServletResponse)
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public AsyncContext startAsync(ServletRequest servletRequest,
ServletResponse servletResponse)
@@ -458,7 +458,7 @@
*
* @see ServletRequest#isAsyncStarted
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean isAsyncStarted() {
return request.isAsyncStarted();
@@ -473,7 +473,7 @@
*
* @see ServletRequest#isAsyncSupported
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean isAsyncSupported() {
return request.isAsyncSupported();
@@ -497,7 +497,7 @@
*
* @see ServletRequest#getAsyncContext
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public AsyncContext getAsyncContext() {
return request.getAsyncContext();
@@ -512,7 +512,7 @@
*
* @see ServletRequest#addAsyncListener(AsyncListener)
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public void addAsyncListener(AsyncListener listener) {
request.addAsyncListener(listener);
@@ -533,7 +533,7 @@
* @see ServletRequest#addAsyncListener(AsyncListener, ServletRequest,
* ServletResponse)
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public void addAsyncListener(AsyncListener listener,
ServletRequest servletRequest,
@@ -555,7 +555,7 @@
*
* @see ServletRequest#setAsyncTimeout
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public void setAsyncTimeout(long timeout) {
request.setAsyncTimeout(timeout);
@@ -571,7 +571,7 @@
*
* @see ServletRequest#getAsyncTimeout
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public long getAsyncTimeout() {
return request.getAsyncTimeout();
@@ -587,7 +587,7 @@
* @return true if this ServletRequestWrapper wraps the
* given ServletRequest instance, false otherwise
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean isWrapperFor(ServletRequest wrapped) {
if (request == wrapped) {
@@ -613,7 +613,7 @@
* @throws IllegalArgumentException if the given class does not
* implement {@link ServletRequest}
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean isWrapperFor(Class wrappedType) {
if (!ServletRequest.class.isAssignableFrom(wrappedType)) {
@@ -638,7 +638,7 @@
*
* @see ServletRequest#getDispatcherType
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public DispatcherType getDispatcherType() {
return request.getDispatcherType();
Modified: trunk/java/javax/servlet/ServletResponse.java
===================================================================
--- trunk/java/javax/servlet/ServletResponse.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/ServletResponse.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -145,7 +145,7 @@
* <code>text/html; charset=UTF-8</code>,
* or null
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public String getContentType();
@@ -251,7 +251,7 @@
* @see #setContentType
* #setLocale
*
- * @since 2.4
+ * @since Servlet 2.4
*
*/
@@ -384,7 +384,7 @@
* @see #isCommitted
* @see #reset
*
- * @since 2.3
+ * @since Servlet 2.3
*/
public void resetBuffer();
Modified: trunk/java/javax/servlet/ServletResponseWrapper.java
===================================================================
--- trunk/java/javax/servlet/ServletResponseWrapper.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/ServletResponseWrapper.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -67,11 +67,10 @@
* This class implements the Wrapper or Decorator pattern. Methods default to
* calling through to the wrapped response object.
*
- * @author Various
- * @since v 2.3
+ * @author Various
+ * @since Servlet 2.3
*
- * @see javax.servlet.ServletResponse
- *
+ * @see javax.servlet.ServletResponse
*/
@@ -115,7 +114,7 @@
* The default behavior of this method is to call setCharacterEncoding(String
charset)
* on the wrapped response object.
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public void setCharacterEncoding(String charset) {
@@ -173,7 +172,7 @@
* The default behavior of this method is to return getContentType()
* on the wrapped response object.
*
- * @since 2.4
+ * @since Servlet 2.4
*/
public String getContentType() {
@@ -258,7 +257,7 @@
* @return true if this ServletResponseWrapper wraps the
* given ServletResponse instance, false otherwise
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean isWrapperFor(ServletResponse wrapped) {
if (response == wrapped) {
@@ -284,7 +283,7 @@
* @throws IllegalArgumentException if the given class does not
* implement {@link ServletResponse}
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean isWrapperFor(Class wrappedType) {
if (!ServletResponse.class.isAssignableFrom(wrappedType)) {
Modified: trunk/java/javax/servlet/SessionCookieConfig.java
===================================================================
--- trunk/java/javax/servlet/SessionCookieConfig.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/SessionCookieConfig.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -33,7 +33,7 @@
* <p>An instance of this class is acquired by a call to
* {@link ServletContext#getSessionCookieConfig}.
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public interface SessionCookieConfig {
Modified: trunk/java/javax/servlet/SessionTrackingMode.java
===================================================================
--- trunk/java/javax/servlet/SessionTrackingMode.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/SessionTrackingMode.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -29,7 +29,7 @@
/**
* Enumeration of session tracking modes.
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public enum SessionTrackingMode {
COOKIE,
Modified: trunk/java/javax/servlet/annotation/HandlesTypes.java
===================================================================
--- trunk/java/javax/servlet/annotation/HandlesTypes.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/annotation/HandlesTypes.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -47,11 +47,9 @@
* This annotation is used to declare the types an instance of the
* ServletContainerInitializer can handle.
*
- * <p>
- *
* @see javax.servlet.ServletContainerInitializer
*
- * @since 3.0
+ * @since Servlet 3.0
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
Added: trunk/java/javax/servlet/annotation/MultipartConfig.java
===================================================================
--- trunk/java/javax/servlet/annotation/MultipartConfig.java (rev
0)
+++ trunk/java/javax/servlet/annotation/MultipartConfig.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -0,0 +1,71 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").
You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package javax.servlet.annotation;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+
+(a)Target(ElementType.TYPE)
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface MultipartConfig {
+ /**
+ * The directory location where files will be stored
+ *
+ */
+ String location() default "";
+
+ /**
+ * the maximum size allowed for files uploaded
+ *
+ */
+ int maxFileSize() default 0;
+
+ /**
+ * The maximum size of a multi-part/form-data request allowed
+ *
+ */
+ int maxRequestSize() default 0;
+
+ /**
+ * The size threshold after which the file will be written to disk
+ *
+ */
+ int fileSizeThreshold() default 0;
+}
Modified: trunk/java/javax/servlet/annotation/WebFilter.java
===================================================================
--- trunk/java/javax/servlet/annotation/WebFilter.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/annotation/WebFilter.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -52,7 +52,7 @@
*
* @see javax.servlet.Filter
*
- * @since 3.0
+ * @since Servlet 3.0
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@@ -118,11 +118,4 @@
*/
boolean asyncSupported() default false;
- /**
- * The timeout for asynchronous operations initiated by the
- * filter.
- *
- * @see javax.servlet.ServletRequest#setAsyncTimeout
- */
- long asyncTimeout() default 60000;
}
Modified: trunk/java/javax/servlet/annotation/WebServlet.java
===================================================================
--- trunk/java/javax/servlet/annotation/WebServlet.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/annotation/WebServlet.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -52,7 +52,7 @@
*
* @see javax.servlet.Servlet
*
- * @since 3.0
+ * @since Servlet 3.0
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@@ -94,14 +94,6 @@
boolean asyncSupported() default false;
/**
- * The timeout for asynchronous operations initiated by the
- * servlet.
- *
- * @see javax.servlet.ServletRequest#setAsyncTimeout
- */
- long asyncTimeout() default 60000;
-
- /**
* The small-icon of the servlet
*/
String smallIcon() default "";
Modified: trunk/java/javax/servlet/http/Cookie.java
===================================================================
--- trunk/java/javax/servlet/http/Cookie.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/http/Cookie.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -586,7 +586,7 @@
* @param isHttpOnly true if this cookie is to be marked as
* <i>HttpOnly</i>, false otherwise
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public void setHttpOnly(boolean isHttpOnly) {
this.isHttpOnly = isHttpOnly;
@@ -598,7 +598,7 @@
* @return true if this cookie has been marked as <i>HttpOnly</i>,
* false otherwise
*
- * @since 3.0
+ * @since Servlet 3.0
*/
public boolean isHttpOnly() {
return isHttpOnly;
Modified: trunk/java/javax/servlet/http/HttpServletRequest.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServletRequest.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/http/HttpServletRequest.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -788,7 +788,28 @@
*
* @exception ServletException ff logout fails.
*/
- public void logout() throws ServletException;
+ public void logout() throws ServletException;
+
+ /**
+ * Retrieves all the parts of the multi-part/form-data http message
+ *
+ * @return An <code>Iterable</code> for all the parts of the
multi-part/form-data request
+ */
+ public Iterable<Part> getParts();
+
+ /**
+ * Returns the part specified by the name.
+ *
+ * @param name the name of the part
+ * @return The part being requested for by name.
+ * @exception IllegalArgumentException If the name specified does not exist
+ *
+ */
+ public Part getPart(String name) throws IllegalArgumentException;
+
+
+
+
}
Modified: trunk/java/javax/servlet/http/HttpServletRequestWrapper.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServletRequestWrapper.java 2009-04-17 12:02:55 UTC
(rev 1016)
+++ trunk/java/javax/servlet/http/HttpServletRequestWrapper.java 2009-04-19 17:17:15 UTC
(rev 1017)
@@ -60,16 +60,15 @@
import java.util.Enumeration;
/**
+ * Provides a convenient implementation of the HttpServletRequest interface
+ * that can be subclassed by developers wishing to adapt the request to a
+ * Servlet.
+ *
+ * <p>This class implements the Wrapper or Decorator pattern. Methods default
+ * to calling through to the wrapped request object.
*
- * Provides a convenient implementation of the HttpServletRequest interface that
- * can be subclassed by developers wishing to adapt the request to a Servlet.
- * This class implements the Wrapper or Decorator pattern. Methods default to
- * calling through to the wrapped request object.
- *
- *
- * @see javax.servlet.http.HttpServletRequest
- * @since v 2.3
- *
+ * @see javax.servlet.http.HttpServletRequest
+ * @since Servlet 2.3
*/
@@ -328,4 +327,28 @@
public void logout() throws ServletException {
this._getHttpServletRequest().logout();
}
+
+ /**
+ * Retrieves all the parts of the multi-part/form-data http message
+ *
+ * @return An <code>Iterable</code> for all the parts of the
multi-part/form-data request
+ */
+ public Iterable<Part> getParts() {
+ return this._getHttpServletRequest().getParts();
+ }
+
+ /**
+ * Returns the part specified by the name.
+ *
+ * @param name the name of the part
+ * @return The part being requested for by name.
+ * @exception IllegalArgumentException If the name specified does not exist
+ *
+ */
+ public Part getPart(String name) throws IllegalArgumentException {
+ return this._getHttpServletRequest().getPart(name);
+
+ }
+
+
}
Modified: trunk/java/javax/servlet/http/HttpServletResponse.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServletResponse.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/http/HttpServletResponse.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -343,9 +343,9 @@
*
* @see #sendError
*/
-
public void setStatus(int sc);
+
/**
* @deprecated As of version 2.1, due to ambiguous meaning of the
* message parameter. To set a status code
@@ -357,7 +357,6 @@
* @param sc the status code
* @param sm the status message
*/
-
public void setStatus(int sc, String sm);
@@ -365,6 +364,8 @@
* Gets the current status code of this response.
*
* @return the current status code of this response
+ *
+ * @since Servlet 3.0
*/
public int getStatus();
@@ -385,6 +386,8 @@
* @return the value of the response header with the given name,
* or <tt>null</tt> if no header with the given name has been set
* on this response
+ *
+ * @since Servlet 3.0
*/
public String getHeader(String name);
@@ -403,6 +406,8 @@
* @return the values of the response header with the given name,
* or an empty <tt>Iterable</tt> if no header with the given name
* has been set on this response
+ *
+ * @since Servlet 3.0
*/
public Iterable<String> getHeaders(String name);
@@ -418,6 +423,8 @@
*
* @return the names of the headers of this response, or an empty
* <tt>Iterable</tt> if no headers have been set on this response
+ *
+ * @since Servlet 3.0
*/
public Iterable<String> getHeaderNames();
Modified: trunk/java/javax/servlet/http/HttpServletResponseWrapper.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServletResponseWrapper.java 2009-04-17 12:02:55 UTC
(rev 1016)
+++ trunk/java/javax/servlet/http/HttpServletResponseWrapper.java 2009-04-19 17:17:15 UTC
(rev 1017)
@@ -67,11 +67,10 @@
* This class implements the Wrapper or Decorator pattern. Methods default to
* calling through to the wrapped response object.
*
- * @author Various
- * @since v 2.3
+ * @author Various
+ * @since Servlet 2.3
*
- * @see javax.servlet.http.HttpServletResponse
- *
+ * @see javax.servlet.http.HttpServletResponse
*/
public class HttpServletResponseWrapper extends ServletResponseWrapper implements
HttpServletResponse {
Modified: trunk/java/javax/servlet/http/HttpSession.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSession.java 2009-04-17 12:02:55 UTC (rev 1016)
+++ trunk/java/javax/servlet/http/HttpSession.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -164,7 +164,7 @@
* Returns the ServletContext to which this session belongs.
*
* @return The ServletContext object for the web application
- * @since 2.3
+ * @since Servlet 2.3
*/
public ServletContext getServletContext();
Modified: trunk/java/javax/servlet/http/HttpSessionActivationListener.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionActivationListener.java 2009-04-17 12:02:55
UTC (rev 1016)
+++ trunk/java/javax/servlet/http/HttpSessionActivationListener.java 2009-04-19 17:17:15
UTC (rev 1017)
@@ -64,7 +64,7 @@
** or persists sessions is required to notify all attributes bound to sessions
** implementing HttpSessionActivationListener.
**
- * @since 2.3
+ * @since Servlet 2.3
*/
public interface HttpSessionActivationListener extends EventListener {
Modified: trunk/java/javax/servlet/http/HttpSessionAttributeListener.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionAttributeListener.java 2009-04-17 12:02:55
UTC (rev 1016)
+++ trunk/java/javax/servlet/http/HttpSessionAttributeListener.java 2009-04-19 17:17:15
UTC (rev 1017)
@@ -61,7 +61,7 @@
/** This listener interface can be implemented in order to
* get notifications of changes to the attribute lists of sessions within
* this web application.
- * @since v 2.3
+ * @since Servlet 2.3
*/
public interface HttpSessionAttributeListener extends EventListener {
Modified: trunk/java/javax/servlet/http/HttpSessionBindingEvent.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionBindingEvent.java 2009-04-17 12:02:55 UTC
(rev 1016)
+++ trunk/java/javax/servlet/http/HttpSessionBindingEvent.java 2009-04-19 17:17:15 UTC
(rev 1017)
@@ -174,7 +174,7 @@
* removed (or unbound), this is the value of the removed attribute. If the attribute was
replaced, this
* is the old value of the attribute.
*
- * @since 2.3
+ * @since Servlet 2.3
*/
public Object getValue() {
Modified: trunk/java/javax/servlet/http/HttpSessionEvent.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionEvent.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/http/HttpSessionEvent.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -59,7 +59,7 @@
/** This is the class representing event notifications for
* changes to sessions within a web application.
- * @since v 2.3
+ * @since Servlet 2.3
*/
public class HttpSessionEvent extends java.util.EventObject {
/** Construct a session event from the given source.*/
Modified: trunk/java/javax/servlet/http/HttpSessionListener.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionListener.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/javax/servlet/http/HttpSessionListener.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -64,7 +64,7 @@
* To receive notification events, the implementation class
* must be configured in the deployment descriptor for the web application.
* @see HttpSessionEvent
- * @since v 2.3
+ * @since Servlet 2.3
*/
public interface HttpSessionListener extends EventListener {
Added: trunk/java/javax/servlet/http/Part.java
===================================================================
--- trunk/java/javax/servlet/http/Part.java (rev 0)
+++ trunk/java/javax/servlet/http/Part.java 2009-04-19 17:17:15 UTC (rev 1017)
@@ -0,0 +1,180 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License").
You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package javax.servlet.http;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+
+/**
+ * <p> This class represents a part or form item that was received within a
+ * <code>multipart/form-data</code> POST request.
+ *
+ */
+public interface Part {
+
+ /**
+ * Gets the content of this part as an <tt>InputStream</tt>
+ *
+ * @return The content of this part as an <tt>InputStream</tt>
+ * @throws IOException If an error occurs in retrieving the contet
+ * as an <tt>InputStream</tt>
+ */
+ public InputStream getInputStream() throws IOException;
+
+ /**
+ * Gets the content type of this part.
+ *
+ * @return The content type of this part.
+ */
+ public String getContentType();
+
+
+ /**
+ * Gets the name of this part
+ *
+ * @return The name of this part as a <tt>String</tt>
+ */
+ public String getName();
+
+
+
+ /**
+ * Returns the size of this fille.
+ *
+ * @return a <code>long</code> specifying the size of this part, in
bytes.
+ */
+ public long getSize();
+
+
+ /**
+ * A convenience method to write this uploaded item to disk.
+ * <p>
+ * This method is not guaranteed to succeed if called more than once for
+ * the same part. This allows a particular implementation to use, for
+ * example, file renaming, where possible, rather than copying all of the
+ * underlying data, thus gaining a significant performance benefit.
+ *
+ * @param fileName a<code>String</code> specifying the file name which
the stream is written out to.
+ * The file is created relative to the location as specified in the MultipartConfig
+ *
+ * @throws IOException if an error occurs.
+ */
+ public void write(String fileName) throws IOException;
+
+
+ /**
+ * Deletes the underlying storage for a file item, including deleting any
+ * associated temporary disk file.
+ *
+ * @throws IOException if an error occurs.
+ */
+ public void delete() throws IOException;
+
+ /**
+ *
+ * Returns the value of the specified mime header
+ * as a <code>String</code>. If the Part did not include a header
+ * of the specified name, this method returns <code>null</code>.
+ * If there are multiple headers with the same name, this method
+ * returns the first header in the part.
+ * The header name is case insensitive. You can use
+ * this method with any request header.
+ *
+ * @param name a <code>String</code> specifying the
+ * header name
+ *
+ * @return a <code>String</code> containing the
+ * value of the requested
+ * header, or <code>null</code>
+ * if the part does not
+ * have a header of that name
+ *
+ */
+
+ public String getHeader(String name);
+
+ /**
+ *
+ * Returns all the values of the specified Part header
+ * as an <code>Iterable</code> of <code>String</code>
objects.
+ *
+ * <p>If the Part did not include any headers
+ * of the specified name, this method returns an empty
+ * <code>Iterable</code>.
+ * The header name is case insensitive. You can use
+ * this method with any Part header.
+ *
+ * @param name a <code>String</code> specifying the
+ * header name
+ *
+ * @return an <code>Iterable</code> containing
+ * the values of the requested header. If
+ * the Part does not have any headers of
+ * that name return an empty
+ * Iterable. If
+ * the container does not allow access to
+ * header information, return null
+ *
+ */
+
+ public Iterable<String> getHeaders(String name);
+
+ /**
+ *
+ * Returns an Iterable of all the header names
+ * this part contains. If the part has no
+ * headers, this method returns an empty Iterable.
+ *
+ * <p>Some servlet containers do not allow
+ * servlets to access headers using this method, in
+ * which case this method returns <code>null</code>
+ *
+ * @return an Iterable of all the
+ * header names sent with this
+ * part; if the part has
+ * no headers, an empty Iterable;
+ * if the servlet container does not
+ * allow servlets to use this method,
+ * <code>null</code>
+ *
+ *
+ */
+
+ public Iterable<String> getHeaderNames();
+
+}
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -80,6 +80,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.Part;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
@@ -106,6 +107,7 @@
import org.apache.tomcat.util.http.FastHttpDateFormat;
import org.apache.tomcat.util.http.Parameters;
import org.apache.tomcat.util.http.ServerCookie;
+import org.apache.tomcat.util.http.fileupload.DiskFileUpload;
import org.apache.tomcat.util.http.mapper.MappingData;
@@ -2971,7 +2973,29 @@
throw new IllegalStateException();
}
-
+
+ public Part getPart(String name) throws IllegalArgumentException {
+ // FIXME: get the config from somewhere
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public Iterable<Part> getParts() {
+ // FIXME: Stub from the example
+ DiskFileUpload fu = new DiskFileUpload();
+ // maximum size before a FileUploadException will be thrown
+ fu.setSizeMax(1000000);
+ // maximum size that will be stored in memory
+ fu.setSizeThreshold(4096);
+ // the location for saving data that is larger than getSizeThreshold()
+ fu.setRepositoryPath("/tmp");
+
+ // FIXME: Store the list in a field locally
+ return fu.parseRequest(getRequest());
+ }
+
+
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append(sm.getString("coyoteRequest.servletStack",
Thread.currentThread().getName()));
@@ -3124,4 +3148,5 @@
}
+
}
Modified: trunk/java/org/apache/catalina/connector/RequestFacade.java
===================================================================
--- trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-04-17 12:02:55 UTC
(rev 1016)
+++ trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-04-19 17:17:15 UTC
(rev 1017)
@@ -39,6 +39,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.Part;
import org.apache.catalina.Globals;
import org.apache.catalina.core.ApplicationFilterChain;
@@ -1120,4 +1121,24 @@
request.logout();
}
+
+ public Part getPart(String name) throws IllegalArgumentException {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+
+ return request.getPart(name);
+ }
+
+
+ public Iterable<Part> getParts() {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+
+ return request.getParts();
+ }
+
}
Modified: trunk/java/org/apache/catalina/core/ClassLoadingAnnotationScanner.java
===================================================================
--- trunk/java/org/apache/catalina/core/ClassLoadingAnnotationScanner.java 2009-04-17
12:02:55 UTC (rev 1016)
+++ trunk/java/org/apache/catalina/core/ClassLoadingAnnotationScanner.java 2009-04-19
17:17:15 UTC (rev 1017)
@@ -22,6 +22,7 @@
import java.util.jar.JarEntry;
import javax.servlet.annotation.HandlesTypes;
+import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebListener;
@@ -40,6 +41,7 @@
try {
Class<?> clazz =
context.getLoader().getClassLoader().loadClass(className);
if (clazz.isAnnotationPresent(HandlesTypes.class)
+ || clazz.isAnnotationPresent(MultipartConfig.class)
|| clazz.isAnnotationPresent(WebFilter.class)
|| clazz.isAnnotationPresent(WebInitParam.class)
|| clazz.isAnnotationPresent(WebListener.class)
Modified: trunk/java/org/apache/catalina/core/DummyRequest.java
===================================================================
--- trunk/java/org/apache/catalina/core/DummyRequest.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/org/apache/catalina/core/DummyRequest.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -44,6 +44,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.Part;
import org.apache.catalina.Context;
import org.apache.catalina.Host;
@@ -289,6 +290,8 @@
public void login(String username, String password) throws ServletException {}
public void logout() throws ServletException {}
public long getAsyncTimeout() { return 0; }
+ public Part getPart(String name) throws IllegalArgumentException { return null; }
+ public Iterable<Part> getParts() { return null; }
}
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -33,6 +33,7 @@
import javax.servlet.DispatcherType;
import javax.servlet.ServletContext;
import javax.servlet.annotation.HandlesTypes;
+import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebListener;
@@ -315,6 +316,10 @@
HandlesTypes annotation = clazz.getAnnotation(HandlesTypes.class);
// FIXME: Ok, this is complex ....
}
+ if (clazz.isAnnotationPresent(MultipartConfig.class)) {
+ MultipartConfig annotation = clazz.getAnnotation(MultipartConfig.class);
+ // FIXME: Do something ....
+ }
if (clazz.isAnnotationPresent(WebFilter.class)) {
WebFilter annotation = clazz.getAnnotation(WebFilter.class);
// Add servlet filter
Modified: trunk/java/org/apache/catalina/startup/TldConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/TldConfig.java 2009-04-17 12:02:55 UTC (rev
1016)
+++ trunk/java/org/apache/catalina/startup/TldConfig.java 2009-04-19 17:17:15 UTC (rev
1017)
@@ -64,60 +64,58 @@
public final class TldConfig {
// Names of JARs that are known not to contain any TLDs
- private static HashSet<String> noTldJars;
+ private static HashSet<String> noDescriptorsJars;
private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( TldConfig.class );
+ org.jboss.logging.Logger.getLogger(TldConfig.class);
/*
- * Initializes the set of JARs that are known not to contain any TLDs
+ * Initializes the set of JARs that are known not to contain any descriptors.
*/
static {
- noTldJars = new HashSet<String>();
+ noDescriptorsJars = new HashSet<String>();
// Bootstrap JARs
- noTldJars.add("bootstrap.jar");
- noTldJars.add("commons-daemon.jar");
- noTldJars.add("tomcat-juli.jar");
+ noDescriptorsJars.add("bootstrap.jar");
+ noDescriptorsJars.add("commons-daemon.jar");
+ noDescriptorsJars.add("tomcat-juli.jar");
// Main JARs
- noTldJars.add("annotations-api.jar");
- noTldJars.add("catalina.jar");
- noTldJars.add("catalina-ant.jar");
- noTldJars.add("catalina-ha.jar");
- noTldJars.add("catalina-tribes.jar");
- noTldJars.add("el-api.jar");
- noTldJars.add("jasper.jar");
- noTldJars.add("jasper-el.jar");
- noTldJars.add("jasper-jdt.jar");
- noTldJars.add("jsp-api.jar");
- noTldJars.add("servlet-api.jar");
- noTldJars.add("tomcat-coyote.jar");
- noTldJars.add("tomcat-dbcp.jar");
+ noDescriptorsJars.add("annotations-api.jar");
+ noDescriptorsJars.add("catalina.jar");
+ noDescriptorsJars.add("catalina-ant.jar");
+ noDescriptorsJars.add("el-api.jar");
+ noDescriptorsJars.add("jasper.jar");
+ noDescriptorsJars.add("jasper-el.jar");
+ noDescriptorsJars.add("jasper-jdt.jar");
+ noDescriptorsJars.add("jsp-api.jar");
+ noDescriptorsJars.add("servlet-api.jar");
+ noDescriptorsJars.add("tomcat-coyote.jar");
+ noDescriptorsJars.add("tomcat-dbcp.jar");
// i18n JARs
- noTldJars.add("tomcat-i18n-en.jar");
- noTldJars.add("tomcat-i18n-es.jar");
- noTldJars.add("tomcat-i18n-fr.jar");
- noTldJars.add("tomcat-i18n-ja.jar");
+ noDescriptorsJars.add("tomcat-i18n-en.jar");
+ noDescriptorsJars.add("tomcat-i18n-es.jar");
+ noDescriptorsJars.add("tomcat-i18n-fr.jar");
+ noDescriptorsJars.add("tomcat-i18n-ja.jar");
// Misc JARs not included with Tomcat
- noTldJars.add("ant.jar");
- noTldJars.add("commons-dbcp.jar");
- noTldJars.add("commons-beanutils.jar");
- noTldJars.add("commons-fileupload-1.0.jar");
- noTldJars.add("commons-pool.jar");
- noTldJars.add("commons-digester.jar");
- noTldJars.add("commons-logging.jar");
- noTldJars.add("commons-collections.jar");
- noTldJars.add("jmx.jar");
- noTldJars.add("jmx-tools.jar");
- noTldJars.add("xercesImpl.jar");
- noTldJars.add("xmlParserAPIs.jar");
- noTldJars.add("xml-apis.jar");
+ noDescriptorsJars.add("ant.jar");
+ noDescriptorsJars.add("commons-dbcp.jar");
+ noDescriptorsJars.add("commons-beanutils.jar");
+ noDescriptorsJars.add("commons-fileupload-1.0.jar");
+ noDescriptorsJars.add("commons-pool.jar");
+ noDescriptorsJars.add("commons-digester.jar");
+ noDescriptorsJars.add("commons-logging.jar");
+ noDescriptorsJars.add("commons-collections.jar");
+ noDescriptorsJars.add("jmx.jar");
+ noDescriptorsJars.add("jmx-tools.jar");
+ noDescriptorsJars.add("xercesImpl.jar");
+ noDescriptorsJars.add("xmlParserAPIs.jar");
+ noDescriptorsJars.add("xml-apis.jar");
// JARs from J2SE runtime
- noTldJars.add("sunjce_provider.jar");
- noTldJars.add("ldapsec.jar");
- noTldJars.add("localedata.jar");
- noTldJars.add("dnsns.jar");
- noTldJars.add("tools.jar");
- noTldJars.add("sunpkcs11.jar");
+ noDescriptorsJars.add("sunjce_provider.jar");
+ noDescriptorsJars.add("ldapsec.jar");
+ noDescriptorsJars.add("localedata.jar");
+ noDescriptorsJars.add("dnsns.jar");
+ noDescriptorsJars.add("tools.jar");
+ noDescriptorsJars.add("sunpkcs11.jar");
}
@@ -167,10 +165,10 @@
*/
public static void setNoTldJars(String jarNames) {
if (jarNames != null) {
- noTldJars.clear();
+ noDescriptorsJars.clear();
StringTokenizer tokenizer = new StringTokenizer(jarNames, ",");
while (tokenizer.hasMoreElements()) {
- noTldJars.add(tokenizer.nextToken());
+ noDescriptorsJars.add(tokenizer.nextToken());
}
}
}
@@ -251,40 +249,13 @@
public void execute() throws Exception {
long t1=System.currentTimeMillis();
- File tldCache=null;
-
- if (context instanceof StandardContext) {
- File workDir= (File)
-
((StandardContext)context).getServletContext().getAttribute(Globals.WORK_DIR_ATTR);
- //tldCache=new File( workDir, "tldCache.ser");
- }
-
- // Option to not rescan
- if( ! rescan ) {
- // find the cache
- if( tldCache!= null && tldCache.exists()) {
- // just read it...
- processCache(tldCache);
- return;
- }
- }
-
/*
* Acquire the list of TLD resource paths, possibly embedded in JAR
* files, to be processed
*/
Set resourcePaths = tldScanResourcePaths();
- Map jarPaths = getJarPaths();
+ Map<String, File> jarPaths = getJarPaths();
- // Check to see if we can use cached listeners
- if (tldCache != null && tldCache.exists()) {
- long lastModified = getLastModified(resourcePaths, jarPaths);
- if (lastModified < tldCache.lastModified()) {
- processCache(tldCache);
- return;
- }
- }
-
// Scan each accumulated resource path for TLDs to be processed
Iterator paths = resourcePaths.iterator();
while (paths.hasNext()) {
@@ -304,18 +275,6 @@
String list[] = getTldListeners();
- if( tldCache!= null ) {
- log.debug( "Saving tld cache: " + tldCache + " " +
list.length);
- try {
- FileOutputStream out=new FileOutputStream(tldCache);
- ObjectOutputStream oos=new ObjectOutputStream( out );
- oos.writeObject( list );
- oos.close();
- } catch( IOException ex ) {
- ex.printStackTrace();
- }
- }
-
if( log.isDebugEnabled() )
log.debug( "Adding tld listeners:" + list.length);
for( int i=0; list!=null && i<list.length; i++ ) {
@@ -572,11 +531,11 @@
* @exception IOException if an input/output error occurs while
* accumulating the list of resource paths
*/
- private Set tldScanResourcePaths() throws IOException {
+ private Set<String> tldScanResourcePaths() throws IOException {
if (log.isDebugEnabled()) {
log.debug(" Accumulating TLD resource paths");
}
- Set resourcePaths = new HashSet();
+ Set<String> resourcePaths = new HashSet<String>();
// Accumulate resource paths explicitly listed in the web application
// deployment descriptor
@@ -675,9 +634,9 @@
*
* @return Map of JAR file paths
*/
- private Map getJarPaths() {
+ private Map<String, File> getJarPaths() {
- HashMap jarPathMap = null;
+ HashMap<String, File> jarPathMap = null;
ClassLoader webappLoader = Thread.currentThread().getContextClassLoader();
ClassLoader loader = webappLoader;
@@ -715,8 +674,8 @@
* that are not known not to contain any TLDs
*/
if (loader == webappLoader
- || noTldJars == null
- || !noTldJars.contains(file.getName())) {
+ || noDescriptorsJars == null
+ || !noDescriptorsJars.contains(file.getName())) {
if (jarPathMap == null) {
jarPathMap = new HashMap();
jarPathMap.put(path, file);
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/DefaultFileItem.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/DefaultFileItem.java 2009-04-17
12:02:55 UTC (rev 1016)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/DefaultFileItem.java 2009-04-19
17:17:15 UTC (rev 1017)
@@ -29,6 +29,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
+import java.util.Map;
/**
@@ -112,8 +113,14 @@
/**
* Output stream for this item.
*/
- private DeferredFileOutputStream dfos;
+ private transient DeferredFileOutputStream dfos;
+
+ /**
+ * Headers associated with the file item.
+ */
+ private Map<String, String> headers;
+
// ----------------------------------------------------------- Constructors
@@ -136,12 +143,14 @@
* exceed the threshold.
*/
DefaultFileItem(String fieldName, String contentType, boolean isFormField,
- String fileName, int sizeThreshold, File repository)
+ String fileName, Map<String, String> headers, int
sizeThreshold,
+ File repository)
{
this.fieldName = fieldName;
this.contentType = contentType;
this.isFormField = isFormField;
this.fileName = fileName;
+ this.headers = headers;
this.sizeThreshold = sizeThreshold;
this.repository = repository;
}
@@ -338,7 +347,7 @@
*
* @exception Exception if an error occurs.
*/
- public void write(File file) throws Exception
+ public void write(File file) throws IOException
{
if (isInMemory())
{
@@ -517,6 +526,26 @@
}
+ public String getHeader(String name) {
+ return headers.get(name);
+ }
+
+
+ public Iterable<String> getHeaderNames() {
+ return headers.keySet();
+ }
+
+
+ public Iterable<String> getHeaders(String name) {
+ // FIXME: Create a Set out of the comma separated values
+ return null;
+ }
+
+
+ public void write(String fileName) throws IOException {
+ write(new File(fileName));
+ }
+
// --------------------------------------------------------- Public methods
@@ -605,4 +634,5 @@
return id;
}
+
}
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/DefaultFileItemFactory.java
===================================================================
---
trunk/java/org/apache/tomcat/util/http/fileupload/DefaultFileItemFactory.java 2009-04-17
12:02:55 UTC (rev 1016)
+++
trunk/java/org/apache/tomcat/util/http/fileupload/DefaultFileItemFactory.java 2009-04-19
17:17:15 UTC (rev 1017)
@@ -19,6 +19,7 @@
package org.apache.tomcat.util.http.fileupload;
import java.io.File;
+import java.util.Map;
/**
@@ -180,11 +181,12 @@
String fieldName,
String contentType,
boolean isFormField,
- String fileName
+ String fileName,
+ Map<String, String> headers
)
{
return new DefaultFileItem(fieldName, contentType,
- isFormField, fileName, sizeThreshold, repository);
+ isFormField, fileName, headers, sizeThreshold, repository);
}
}
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/DiskFileUpload.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/DiskFileUpload.java 2009-04-17
12:02:55 UTC (rev 1016)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/DiskFileUpload.java 2009-04-19
17:17:15 UTC (rev 1017)
@@ -190,7 +190,7 @@
* @exception FileUploadException if there are problems reading/parsing
* the request or storing files.
*/
- public List /* FileItem */ parseRequest(HttpServletRequest req,
+ public List<FileItem> parseRequest(HttpServletRequest req,
int sizeThreshold,
long sizeMax, String path)
throws FileUploadException
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java 2009-04-17 12:02:55
UTC (rev 1016)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java 2009-04-19 17:17:15
UTC (rev 1017)
@@ -21,12 +21,13 @@
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
+import javax.servlet.http.Part;
+
/**
* <p> This class represents a file or form item that was received within a
* <code>multipart/form-data</code> POST request.
@@ -55,47 +56,10 @@
* @version $Id$
*/
public interface FileItem
- extends Serializable
+ extends Part, Serializable
{
- // ------------------------------- Methods from javax.activation.DataSource
-
-
- /**
- * Returns an {@link java.io.InputStream InputStream} that can be
- * used to retrieve the contents of the file.
- *
- * @return An {@link java.io.InputStream InputStream} that can be
- * used to retrieve the contents of the file.
- *
- * @exception IOException if an error occurs.
- */
- InputStream getInputStream()
- throws IOException;
-
-
- /**
- * Returns the content type passed by the browser or <code>null</code>
if
- * not defined.
- *
- * @return The content type passed by the browser or <code>null</code>
if
- * not defined.
- */
- String getContentType();
-
-
- /**
- * Returns the original filename in the client's filesystem, as provided by
- * the browser (or other client software). In most cases, this will be the
- * base file name, without path information. However, some clients, such as
- * the Opera browser, do include path information.
- *
- * @return The original filename in the client's filesystem.
- */
- String getName();
-
-
// ------------------------------------------------------- FileItem methods
@@ -110,14 +74,6 @@
/**
- * Returns the size of the file item.
- *
- * @return The size of the file item, in bytes.
- */
- long getSize();
-
-
- /**
* Returns the contents of the file item as an array of bytes.
*
* @return The contents of the file item as an array of bytes.
@@ -167,20 +123,10 @@
*
* @exception Exception if an error occurs.
*/
- void write(File file) throws Exception;
+ void write(File file) throws IOException;
/**
- * Deletes the underlying storage for a file item, including deleting any
- * associated temporary disk file. Although this storage will be deleted
- * automatically when the <code>FileItem</code> instance is garbage
- * collected, this method can be used to ensure that this is done at an
- * earlier time, thus preserving system resources.
- */
- void delete();
-
-
- /**
* Returns the name of the field in the multipart form corresponding to
* this file item.
*
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/FileItemFactory.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/FileItemFactory.java 2009-04-17
12:02:55 UTC (rev 1016)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/FileItemFactory.java 2009-04-19
17:17:15 UTC (rev 1017)
@@ -18,7 +18,9 @@
package org.apache.tomcat.util.http.fileupload;
+import java.util.Map;
+
/**
* <p>A factory interface for creating {@link FileItem} instances. Factories
* can provide their own custom configuration, over and above that provided
@@ -48,6 +50,7 @@
String fieldName,
String contentType,
boolean isFormField,
- String fileName
+ String fileName,
+ Map<String, String> headers
);
}
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java 2009-04-17
12:02:55 UTC (rev 1016)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java 2009-04-19
17:17:15 UTC (rev 1017)
@@ -239,7 +239,7 @@
* @exception FileUploadException if there are problems reading/parsing
* the request or storing files.
*/
- public List /* FileItem */ parseRequest(HttpServletRequest req)
+ public List<FileItem> parseRequest(HttpServletRequest req)
throws FileUploadException
{
if (null == req)
@@ -247,7 +247,7 @@
throw new NullPointerException("req parameter");
}
- ArrayList items = new ArrayList();
+ ArrayList<FileItem> items = new ArrayList<FileItem>();
String contentType = req.getHeader(CONTENT_TYPE);
if ((null == contentType) || (!contentType.startsWith(MULTIPART)))
@@ -295,7 +295,7 @@
boolean nextPart = multi.skipPreamble();
while (nextPart)
{
- Map headers = parseHeaders(multi.readHeaders());
+ Map<String, String> headers = parseHeaders(multi.readHeaders());
String fieldName = getFieldName(headers);
if (fieldName != null)
{
@@ -456,14 +456,15 @@
*
* @exception FileUploadException if an error occurs.
*/
- protected FileItem createItem(Map /* String, String */ headers,
+ protected FileItem createItem(Map<String, String> headers,
boolean isFormField)
throws FileUploadException
{
return getFileItemFactory().createItem(getFieldName(headers),
getHeader(headers, CONTENT_TYPE),
isFormField,
- getFileName(headers));
+ getFileName(headers),
+ headers);
}
@@ -479,9 +480,9 @@
*
* @return A <code>Map</code> containing the parsed HTTP request
headers.
*/
- protected Map /* String, String */ parseHeaders(String headerPart)
+ protected Map<String, String> parseHeaders(String headerPart)
{
- Map headers = new HashMap();
+ Map<String, String> headers = new HashMap<String, String>();
char buffer[] = new char[MAX_HEADER_SIZE];
boolean done = false;
int j = 0;
Modified: trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadException.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadException.java 2009-04-17
12:02:55 UTC (rev 1016)
+++ trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadException.java 2009-04-19
17:17:15 UTC (rev 1017)
@@ -18,7 +18,9 @@
package org.apache.tomcat.util.http.fileupload;
+import java.io.IOException;
+
/**
* Exception for errors encountered while processing the request.
*
@@ -26,7 +28,7 @@
* @version $Id$
*/
public class FileUploadException
- extends Exception
+ extends IOException
{
/**