Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 19 | package org.apache.felix.scr.annotations.sling; |
| 20 | |
Carsten Ziegeler | 5c4c73a | 2011-05-05 13:03:38 +0000 | [diff] [blame] | 21 | import java.lang.annotation.*; |
Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 22 | |
| 23 | /** |
Carsten Ziegeler | f1d585b | 2010-04-27 07:02:23 +0000 | [diff] [blame] | 24 | * Marks servlet classes as SCR component, and allows to configure |
| 25 | * Sling's resource resolver mapping. |
Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 26 | */ |
| 27 | @Target(ElementType.TYPE) |
Carsten Ziegeler | 58844d8 | 2011-12-14 08:44:57 +0000 | [diff] [blame] | 28 | @Retention(RetentionPolicy.CLASS) |
Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 29 | @Documented |
| 30 | public @interface SlingServlet { |
| 31 | |
| 32 | /** |
Carsten Ziegeler | c1b866e | 2010-04-27 09:40:24 +0000 | [diff] [blame] | 33 | * Whether to generate a default SCR component tag. If |
Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 34 | * 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 Ziegeler | f1d585b | 2010-04-27 07:02:23 +0000 | [diff] [blame] | 41 | * Whether to generate a default SCR service tag with |
Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 42 | * "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 Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 49 | * One or more paths under which the servlet will be registered in the |
| 50 | * Sling Resource tree. |
Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 51 | * <p> |
Felix Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 52 | * 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 Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 57 | */ |
| 58 | String[] paths() default {}; |
| 59 | |
| 60 | /** |
Felix Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 61 | * One or more resource types which are handled by this servlet. |
Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 62 | * <p> |
Felix Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 63 | * 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 Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 68 | */ |
| 69 | String[] resourceTypes() default {}; |
| 70 | |
| 71 | /** |
Felix Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 72 | * 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 Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 75 | * <p> |
Felix Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 76 | * 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 Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 79 | */ |
| 80 | String[] selectors() default {}; |
| 81 | |
| 82 | /** |
Felix Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 83 | * One or more request URL extensions supported by the servlet. |
Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 84 | * <p> |
Felix Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 85 | * 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 Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 88 | */ |
| 89 | String[] extensions() default {}; |
| 90 | |
| 91 | /** |
Felix Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 92 | * One or more request methods supported by the servlet. |
Carsten Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 93 | * <p> |
Felix Meschberger | 1f80342 | 2010-08-06 13:56:32 +0000 | [diff] [blame] | 94 | * 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 Ziegeler | 5d33aaf | 2009-05-19 06:24:41 +0000 | [diff] [blame] | 97 | */ |
| 98 | String[] methods() default {}; |
| 99 | |
Carsten Ziegeler | 5c4c73a | 2011-05-05 13:03:38 +0000 | [diff] [blame] | 100 | /** |
| 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: %<name>.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: %<name>.description |
| 128 | * @since 1.6 |
| 129 | */ |
| 130 | String description() default ""; |
| 131 | } |