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.Documented;
20 import java.lang.annotation.ElementType;
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 import java.lang.annotation.Target;
26 * This annotation is used to declare the configuration of an
27 * {@link javax.servlet.Servlet}. <br/>
29 * If the name attribute is not defined, the fully qualified name of the class
33 * At least one URL pattern MUST be declared in either the {@code value} or
34 * {@code urlPattern} attribute of the annotation, but not both.<br/>
37 * The {@code value} attribute is recommended for use when the URL pattern is
38 * the only attribute being set, otherwise the {@code urlPattern} attribute
39 * should be used.<br />
42 * The class on which this annotation is declared MUST extend
43 * {@link javax.servlet.http.HttpServlet}. <br />
46 * E.g. <code>@WebServlet("/path")}<br />
47 * public class TestServlet extends HttpServlet ... {</code><br />
50 * <code>@WebServlet(name="TestServlet", urlPatterns={"/path", "/alt"}) <br />
51 * public class TestServlet extends HttpServlet ... {</code><br />
53 * @since Servlet 3.0 (Section 8.1.1)
56 @Target({ElementType.TYPE})
57 @Retention(RetentionPolicy.RUNTIME)
59 public @interface WebServlet {
62 * @return name of the Servlet
64 String name() default "";
67 * A convenience method, to allow extremely simple annotation of a class.
69 * @return array of URL patterns
72 String[] value() default {};
75 * @return array of URL patterns to which this Filter applies
77 String[] urlPatterns() default {};
80 * @return load on startup ordering hint
82 int loadOnStartup() default -1;
85 * @return array of initialization params for this Servlet
87 WebInitParam[] initParams() default {};
90 * @return asynchronous operation supported by this Servlet
92 boolean asyncSupported() default false;
95 * @return small icon for this Servlet, if present
97 String smallIcon() default "";
100 * @return large icon for this Servlet, if present
102 String largeIcon() default "";
105 * @return description of this Servlet, if present
107 String description() default "";
110 * @return display name of this Servlet, if present
112 String displayName() default "";