blob: 541e651081b0c07c067b2aa1f1d4e2b2e3f68e02 [file] [log] [blame]
Carsten Ziegelerf1d585b2010-04-27 07:02:23 +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 Ziegeler9fc79cf2015-04-21 07:45:38 +000021import java.lang.annotation.Documented;
22import java.lang.annotation.ElementType;
23import java.lang.annotation.Retention;
24import java.lang.annotation.RetentionPolicy;
25import java.lang.annotation.Target;
Carsten Ziegelerf1d585b2010-04-27 07:02:23 +000026
27/**
28 * Marks servlet classes as SCR component, and allows to add a
Carsten Ziegeler9fc79cf2015-04-21 07:45:38 +000029 * filter to Apache Sling's request processing.
30 * This annotation generates two private properties for the
Carsten Ziegelerf1d585b2010-04-27 07:02:23 +000031 * order and the scope.
32 * By default it also generates a component and a service tag,
Carsten Ziegeler9fc79cf2015-04-21 07:45:38 +000033 * but this generation can be omitted.
Carsten Ziegelerf1d585b2010-04-27 07:02:23 +000034 */
35@Target(ElementType.TYPE)
Carsten Ziegeler58844d82011-12-14 08:44:57 +000036@Retention(RetentionPolicy.CLASS)
Carsten Ziegelerf1d585b2010-04-27 07:02:23 +000037@Documented
38public @interface SlingFilter {
39
40 /**
41 * The order of the filter.
Carsten Ziegeler9fc79cf2015-04-21 07:45:38 +000042 * 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 Ziegelerf1d585b2010-04-27 07:02:23 +000051 */
52 int order();
53
54 /**
Carsten Ziegelerfe504062015-10-15 14:49:36 +000055 * 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 Ziegelerc8ea1262011-05-18 14:03:10 +000061 * The scopes of a filter.
Carsten Ziegelerf1d585b2010-04-27 07:02:23 +000062 * 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 Ziegelerc8ea1262011-05-18 14:03:10 +000066 SlingFilterScope[] scope() default SlingFilterScope.REQUEST;
Carsten Ziegelerf1d585b2010-04-27 07:02:23 +000067
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: %&lt;name&gt;.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: %&lt;name&gt;.description
109 */
110 String description() default "";
111}