2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package javax.servlet.annotation;
19 import java.lang.annotation.ElementType;
20 import java.lang.annotation.Retention;
21 import java.lang.annotation.RetentionPolicy;
22 import java.lang.annotation.Target;
25 * This annotation is used to indicate that the {@link javax.servlet.Servlet} on
26 * which it is declared expects requests to made using the {@code
27 * multipart/form-data} MIME type. <br />
30 * {@link javax.servlet.http.Part} components of a given {@code
31 * multipart/form-data} request are retrieved by a Servlet annotated with
32 * {@code MultipartConfig} by calling
33 * {@link javax.servlet.http.HttpServletRequest#getPart} or
34 * {@link javax.servlet.http.HttpServletRequest#getParts}.<br />
37 * E.g. <code>@WebServlet("/upload")}</code><br />
39 * <code>@MultipartConfig()</code> <code>public class UploadServlet extends
40 * HttpServlet ... } </code><br />
44 @Target({ElementType.TYPE})
45 @Retention(RetentionPolicy.RUNTIME)
46 public @interface MultipartConfig {
49 * @return location in which the Container stores temporary files
51 String location() default "";
54 * @return the maximum size allowed for uploaded files (in bytes)
56 long maxFileSize() default -1L;
59 * @return the maximum size of the request allowed for {@code
60 * multipart/form-data}
62 long maxRequestSize() default -1L;
65 * @return the size threshold at which the file will be written to the disk
67 int fileSizeThreshold() default 0;