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 | |
| 21 | import java.lang.annotation.Documented; |
| 22 | import java.lang.annotation.ElementType; |
| 23 | import java.lang.annotation.Retention; |
| 24 | import java.lang.annotation.RetentionPolicy; |
| 25 | import java.lang.annotation.Target; |
| 26 | |
| 27 | /** |
| 28 | * Marks servlet classes as felix SCR component, and allows to configure sling |
| 29 | * resource resolving mapping. |
| 30 | */ |
| 31 | @Target(ElementType.TYPE) |
| 32 | @Retention(RetentionPolicy.SOURCE) |
| 33 | @Documented |
| 34 | public @interface SlingServlet { |
| 35 | |
| 36 | /** |
| 37 | * Whether to generate a default SCR component tag with "immediate=true". If |
| 38 | * set to false, a {@link org.apache.felix.scr.annotations.Component} |
| 39 | * annotation can be added manually with defined whatever configuration |
| 40 | * needed. |
| 41 | */ |
| 42 | boolean generateComponent() default true; |
| 43 | |
| 44 | /** |
| 45 | * Whether to generate a default SCR service tag with with |
| 46 | * "interface=javax.servlet.Servlet". If set to false, a |
| 47 | * {@link org.apache.felix.scr.annotations.Service} annotation can be added |
| 48 | * manually with defined whatever configuration needed. |
| 49 | */ |
| 50 | boolean generateService() default true; |
| 51 | |
| 52 | /** |
| 53 | * The name of the service registration property of a Servlet registered as |
| 54 | * a service providing the absolute paths under which the servlet is |
| 55 | * accessible as a Resource (value is "sling.servlet.paths") |
| 56 | * <p> |
| 57 | * The type of this property is a String or String[] (array of strings) |
| 58 | * denoting the resource types. |
| 59 | */ |
| 60 | String[] paths() default {}; |
| 61 | |
| 62 | /** |
| 63 | * The name of the service registration property of a Servlet registered as |
| 64 | * a service containing the resource type(s) supported by the servlet (value |
| 65 | * is "sling.servlet.resourceTypes"). |
| 66 | * <p> |
| 67 | * The type of this property is a String or String[] (array of strings) |
| 68 | * denoting the resource types. This property is ignored if the |
| 69 | * {@link #paths} property is set. Otherwise this property must be set or |
| 70 | * the servlet is ignored. |
| 71 | */ |
| 72 | String[] resourceTypes() default {}; |
| 73 | |
| 74 | /** |
| 75 | * The name of the service registration property of a Servlet registered as |
| 76 | * a service containing the request URL selectors supported by the servlet |
| 77 | * (value is "sling.servlet.selectors"). The selectors must be configured as |
| 78 | * they would be specified in the URL that is as a list of dot-separated |
| 79 | * strings such as <em>print.a4</em>. |
| 80 | * <p> |
| 81 | * The type of this property is a String or String[] (array of strings) |
| 82 | * denoting the resource types. This property is ignored if the |
| 83 | * {@link #paths} property is set. Otherwise this property is optional and |
| 84 | * ignored if not set. |
| 85 | */ |
| 86 | String[] selectors() default {}; |
| 87 | |
| 88 | /** |
| 89 | * The name of the service registration property of a Servlet registered as |
| 90 | * a service containing the request URL extensions supported by the servlet |
| 91 | * for GET requests (value is "sling.servlet.extensions"). |
| 92 | * <p> |
| 93 | * The type of this property is a String or String[] (array of strings) |
| 94 | * denoting the resource types. This property is ignored if the |
| 95 | * {@link #paths} property is set. Otherwise this property or the |
| 96 | * {@link #methods} is optional and ignored if not set. |
| 97 | */ |
| 98 | String[] extensions() default {}; |
| 99 | |
| 100 | /** |
| 101 | * The name of the service registration property of a Servlet registered as |
| 102 | * a service containing the request methods supported by the servlet (value |
| 103 | * is "sling.servlet.methods"). |
| 104 | * <p> |
| 105 | * The type of this property is a String or String[] (array of strings) |
| 106 | * denoting the resource types. This property is ignored if the |
| 107 | * {@link #paths} property is set. Otherwise this property or the |
| 108 | * {@link #extensions} is optional and ignored if not set. |
| 109 | */ |
| 110 | String[] methods() default {}; |
| 111 | |
| 112 | } |