Carsten Ziegeler | f1d585b | 2010-04-27 07:02:23 +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 | 9fc79cf | 2015-04-21 07:45:38 +0000 | [diff] [blame] | 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; |
Carsten Ziegeler | f1d585b | 2010-04-27 07:02:23 +0000 | [diff] [blame] | 26 | |
| 27 | /** |
| 28 | * Marks servlet classes as SCR component, and allows to add a |
Carsten Ziegeler | 9fc79cf | 2015-04-21 07:45:38 +0000 | [diff] [blame] | 29 | * filter to Apache Sling's request processing. |
| 30 | * This annotation generates two private properties for the |
Carsten Ziegeler | f1d585b | 2010-04-27 07:02:23 +0000 | [diff] [blame] | 31 | * order and the scope. |
| 32 | * By default it also generates a component and a service tag, |
Carsten Ziegeler | 9fc79cf | 2015-04-21 07:45:38 +0000 | [diff] [blame] | 33 | * but this generation can be omitted. |
Carsten Ziegeler | f1d585b | 2010-04-27 07:02:23 +0000 | [diff] [blame] | 34 | */ |
| 35 | @Target(ElementType.TYPE) |
Carsten Ziegeler | 58844d8 | 2011-12-14 08:44:57 +0000 | [diff] [blame] | 36 | @Retention(RetentionPolicy.CLASS) |
Carsten Ziegeler | f1d585b | 2010-04-27 07:02:23 +0000 | [diff] [blame] | 37 | @Documented |
| 38 | public @interface SlingFilter { |
| 39 | |
| 40 | /** |
| 41 | * The order of the filter. |
Carsten Ziegeler | 9fc79cf | 2015-04-21 07:45:38 +0000 | [diff] [blame] | 42 | * This value is used to sort the filters. Filters with a higher order |
| 43 | * are executed before a filter with a lower order. If two filters |
| 44 | * have the same order, the one with the lower service id is executed |
| 45 | * first. |
| 46 | * Please note that the ordering is actually depending on the used |
| 47 | * Apache Sling Engine bundle version. Version older than 2.3.4 of that |
| 48 | * bundle are sorting the filters in the wrong reverse order. Make |
| 49 | * sure to run a newer version of the Sling engine to get the |
| 50 | * correct ordering. |
Carsten Ziegeler | f1d585b | 2010-04-27 07:02:23 +0000 | [diff] [blame] | 51 | */ |
| 52 | int order(); |
| 53 | |
| 54 | /** |
Carsten Ziegeler | fe50406 | 2015-10-15 14:49:36 +0000 | [diff] [blame^] | 55 | * Restrict the filter to paths that match the supplied regular expression. Requires Sling Engine 2.4.0. |
| 56 | * @since 1.10.0 |
| 57 | */ |
| 58 | String pattern() default ""; |
| 59 | |
| 60 | /** |
Carsten Ziegeler | c8ea126 | 2011-05-18 14:03:10 +0000 | [diff] [blame] | 61 | * The scopes of a filter. |
Carsten Ziegeler | f1d585b | 2010-04-27 07:02:23 +0000 | [diff] [blame] | 62 | * If the filter has request scope, it is run once for a request. |
| 63 | * If the filter has component scope, it is run once for every included |
| 64 | * component (rendering). |
| 65 | */ |
Carsten Ziegeler | c8ea126 | 2011-05-18 14:03:10 +0000 | [diff] [blame] | 66 | SlingFilterScope[] scope() default SlingFilterScope.REQUEST; |
Carsten Ziegeler | f1d585b | 2010-04-27 07:02:23 +0000 | [diff] [blame] | 67 | |
| 68 | /** |
| 69 | * Whether to generate a default SCR component tag with. If |
| 70 | * set to false, a {@link org.apache.felix.scr.annotations.Component} |
| 71 | * annotation can be added manually with defined whatever configuration |
| 72 | * needed. |
| 73 | */ |
| 74 | boolean generateComponent() default true; |
| 75 | |
| 76 | /** |
| 77 | * Whether to generate a default SCR service tag with |
| 78 | * "interface=javax.servlet.Filter". If set to false, a |
| 79 | * {@link org.apache.felix.scr.annotations.Service} annotation can be added |
| 80 | * manually with defined whatever configuration needed. |
| 81 | */ |
| 82 | boolean generateService() default true; |
| 83 | |
| 84 | /** |
| 85 | * Defines the Component name also used as the PID for the Configuration |
| 86 | * Admin Service. Default value: Fully qualified name of the Java class. |
| 87 | */ |
| 88 | String name() default ""; |
| 89 | |
| 90 | /** |
| 91 | * Whether Metatype Service data is generated or not. If this parameter is |
| 92 | * set to true Metatype Service data is generated in the |
| 93 | * <code>metatype.xml</code> file for this component. Otherwise no Metatype |
| 94 | * Service data is generated for this component. |
| 95 | */ |
| 96 | boolean metatype() default false; |
| 97 | |
| 98 | /** |
| 99 | * This is generally used as a title for the object described by the meta |
| 100 | * type. This name may be localized by prepending a % sign to the name. |
| 101 | * Default value: %<name>.name |
| 102 | */ |
| 103 | String label() default ""; |
| 104 | |
| 105 | /** |
| 106 | * This is generally used as a description for the object described by the |
| 107 | * meta type. This name may be localized by prepending a % sign to the name. |
| 108 | * Default value: %<name>.description |
| 109 | */ |
| 110 | String description() default ""; |
| 111 | } |