blob: 06f4e0d0473edea50f78922ddfa2b18c5c783384 [file] [log] [blame]
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.apache.felix.scr.annotations.sling;
20
Carsten Ziegeler5c4c73a2011-05-05 13:03:38 +000021import java.lang.annotation.*;
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000022
23/**
Carsten Ziegelerf1d585b2010-04-27 07:02:23 +000024 * Marks servlet classes as SCR component, and allows to configure
25 * Sling's resource resolver mapping.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000026 */
27@Target(ElementType.TYPE)
Carsten Ziegeler58844d82011-12-14 08:44:57 +000028@Retention(RetentionPolicy.CLASS)
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000029@Documented
30public @interface SlingServlet {
31
32 /**
Carsten Ziegelerc1b866e2010-04-27 09:40:24 +000033 * Whether to generate a default SCR component tag. If
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000034 * set to false, a {@link org.apache.felix.scr.annotations.Component}
35 * annotation can be added manually with defined whatever configuration
36 * needed.
37 */
38 boolean generateComponent() default true;
39
40 /**
Carsten Ziegelerf1d585b2010-04-27 07:02:23 +000041 * Whether to generate a default SCR service tag with
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000042 * "interface=javax.servlet.Servlet". If set to false, a
43 * {@link org.apache.felix.scr.annotations.Service} annotation can be added
44 * manually with defined whatever configuration needed.
45 */
46 boolean generateService() default true;
47
48 /**
Felix Meschberger1f803422010-08-06 13:56:32 +000049 * One or more paths under which the servlet will be registered in the
50 * Sling Resource tree.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000051 * <p>
Felix Meschberger1f803422010-08-06 13:56:32 +000052 * This attribute is converted to values for the
53 * <code>sling.servlet.paths</code> property.
54 * <p>
55 * Note that to be used as a servlet for Sling either this attribute or
56 * the {@link #resourceTypes()} attribute or both must be set.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000057 */
58 String[] paths() default {};
59
60 /**
Felix Meschberger1f803422010-08-06 13:56:32 +000061 * One or more resource types which are handled by this servlet.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000062 * <p>
Felix Meschberger1f803422010-08-06 13:56:32 +000063 * This attribute is converted to values for the
64 * <code>sling.servlet.resourceTypes</code> property.
65 * <p>
66 * Note that to be used as a servlet for Sling either this attribute or
67 * the {@link #paths()} attribute or both must be set.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000068 */
69 String[] resourceTypes() default {};
70
71 /**
Felix Meschberger1f803422010-08-06 13:56:32 +000072 * One ore more request URL selectors supported by the servlet. The
73 * selectors must be configured as they would be specified in the URL that
74 * is as a list of dot-separated strings such as <em>print.a4</em>.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000075 * <p>
Felix Meschberger1f803422010-08-06 13:56:32 +000076 * This attribute is converted to values for the
77 * <code>sling.servlet.selectors</code> property and is ignored if the
78 * {@link #resourceTypes()} attribute is not set.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000079 */
80 String[] selectors() default {};
81
82 /**
Felix Meschberger1f803422010-08-06 13:56:32 +000083 * One or more request URL extensions supported by the servlet.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000084 * <p>
Felix Meschberger1f803422010-08-06 13:56:32 +000085 * This attribute is converted to values for the
86 * <code>sling.servlet.extensions</code> property and is ignored if the
87 * {@link #resourceTypes()} attribute is not set.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000088 */
89 String[] extensions() default {};
90
91 /**
Felix Meschberger1f803422010-08-06 13:56:32 +000092 * One or more request methods supported by the servlet.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000093 * <p>
Felix Meschberger1f803422010-08-06 13:56:32 +000094 * This attribute is converted to values for the
95 * <code>sling.servlet.methods</code> property and is ignored if the
96 * {@link #resourceTypes()} attribute is not set.
Carsten Ziegeler5d33aaf2009-05-19 06:24:41 +000097 */
98 String[] methods() default {};
99
Carsten Ziegeler5c4c73a2011-05-05 13:03:38 +0000100 /**
101 * Defines the Component name also used as the PID for the Configuration
102 * Admin Service. Default value: Fully qualified name of the Java class.
103 * @since 1.6
104 */
105 String name() default "";
106
107 /**
108 * Whether Metatype Service data is generated or not. If this parameter is
109 * set to true Metatype Service data is generated in the
110 * <code>metatype.xml</code> file for this component. Otherwise no Metatype
111 * Service data is generated for this component.
112 * @since 1.6
113 */
114 boolean metatype() default false;
115
116 /**
117 * This is generally used as a title for the object described by the meta
118 * type. This name may be localized by prepending a % sign to the name.
119 * Default value: %&lt;name&gt;.name
120 * @since 1.6
121 */
122 String label() default "";
123
124 /**
125 * This is generally used as a description for the object described by the
126 * meta type. This name may be localized by prepending a % sign to the name.
127 * Default value: %&lt;name&gt;.description
128 * @since 1.6
129 */
130 String description() default "";
131 }