This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations.git
commit e76ea6837476cc618a5dc99875e42aa3cc241740 Author: Konrad Windszus <[email protected]> AuthorDate: Wed Oct 15 16:01:05 2025 +0200 SLING-12968 Apply code formatting --- pom.xml | 79 +++++++++++----------- .../servlets/annotations/SlingServletFilter.java | 27 ++++---- .../annotations/SlingServletFilterScope.java | 12 ++-- .../servlets/annotations/SlingServletName.java | 26 +++---- .../servlets/annotations/SlingServletPaths.java | 29 ++++---- .../annotations/SlingServletPathsStrict.java | 43 ++++++------ .../servlets/annotations/SlingServletPrefix.java | 29 ++++---- .../annotations/SlingServletResourceTypes.java | 27 ++++---- 8 files changed, 142 insertions(+), 130 deletions(-) diff --git a/pom.xml b/pom.xml index af1f5f7..5ef7a9d 100644 --- a/pom.xml +++ b/pom.xml @@ -23,15 +23,13 @@ <version>1.2.7-SNAPSHOT</version> <name>Apache Sling Servlet Annotations</name> - <description> - OSGi DS 1.4 component property type annotations for Sling servlets and filters - </description> + <description>OSGi DS 1.4 component property type annotations for Sling servlets and filters</description> <scm> <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations.git</connection> <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations.git</developerConnection> - <url>https://github.com/apache/sling-org-apache-sling-servlets-annotations.git</url> <tag>HEAD</tag> + <url>https://github.com/apache/sling-org-apache-sling-servlets-annotations.git</url> </scm> <properties> @@ -39,6 +37,44 @@ <project.build.outputTimestamp>2021-06-07T21:11:58Z</project.build.outputTimestamp> </properties> + <dependencies> + <!-- all transitive dependencies should have scope "provided" to prevent classpath + pollution of referencing projects --> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.component.annotations</artifactId> + <version>1.4.0</version> + <!-- for annotation @ComponentPropertyType --> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.component</artifactId> + <version>1.4.0</version> + <!-- for link in javadoc to default property types/annotations --> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.bundle</artifactId> + <version>1.0.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.api</artifactId> + <!-- https://issues.apache.org/jira/browse/SLING-8170 --> + <version>2.20.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <!-- for link in javadoc --> + <scope>provided</scope> + </dependency> + </dependencies> + <build> <plugins> <plugin> @@ -93,39 +129,4 @@ </plugins> </build> - <dependencies> - <!-- all transitive dependencies should have scope "provided" to prevent classpath - pollution of referencing projects --> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.service.component.annotations</artifactId> - <version>1.4.0</version><!-- for annotation @ComponentPropertyType --> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.service.component</artifactId> - <version>1.4.0</version><!-- for link in javadoc to default property types/annotations --> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.annotation.bundle</artifactId> - <version>1.0.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.sling</groupId> - <artifactId>org.apache.sling.api</artifactId> - <!-- https://issues.apache.org/jira/browse/SLING-8170 --> - <version>2.20.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId><!-- for link in javadoc --> - <scope>provided</scope> - </dependency> - </dependencies> - </project> diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilter.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilter.java index 5e796eb..68ee813 100644 --- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilter.java +++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilter.java @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.sling.servlets.annotations; @@ -124,5 +126,4 @@ public @interface SlingServletFilter { * @return the selectors to restrict the filter */ String[] selectors() default {}; - } diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilterScope.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilterScope.java index 6778346..1d3b6c9 100644 --- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilterScope.java +++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilterScope.java @@ -20,21 +20,22 @@ package org.apache.sling.servlets.annotations; import javax.servlet.RequestDispatcher; import javax.servlet.http.HttpServletResponse; + /** * The possible scopes for the {@link SlingServletFilter#scope()} annotation. */ public enum SlingServletFilterScope { /** - * Filters are called once per request hitting Sling from the outside. - * These filters are called after the resource addressed by the request URL and the Servlet or script to process the request has been resolved + * Filters are called once per request hitting Sling from the outside. + * These filters are called after the resource addressed by the request URL and the Servlet or script to process the request has been resolved * before the COMPONENT filters (if any) and the Servlet or script are called. * <p>Servlet API Correspondence: {@code REQUEST}</p> */ REQUEST("REQUEST"), /** - * Filters are called upon calling the {@link RequestDispatcher#include(javax.servlet.ServletRequest, javax.servlet.ServletResponse)} + * Filters are called upon calling the {@link RequestDispatcher#include(javax.servlet.ServletRequest, javax.servlet.ServletResponse)} * method after the included resource and the Servlet or script to process the include have been resolved before the Servlet or script is called. * <p>Servlet API Correspondence: {@code REQUEST},{@code INCLUDE},{@code FORWARD}</p> */ @@ -48,7 +49,7 @@ public enum SlingServletFilterScope { ERROR("ERROR"), /** - * Filters are called upon calling the RequestDispatcher.include method after the included resource and the Servlet + * Filters are called upon calling the RequestDispatcher.include method after the included resource and the Servlet * or script to process the include have been resolved before the Servlet or script is called. * <p>Servlet API Correspondence: {@code INCLUDE}</p> */ @@ -78,5 +79,4 @@ public enum SlingServletFilterScope { public String toString() { return this.getScope(); } - -} \ No newline at end of file +} diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletName.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletName.java index b6fe56b..f1a3e32 100644 --- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletName.java +++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletName.java @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.sling.servlets.annotations; diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletPaths.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletPaths.java index effe315..1d515b8 100644 --- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletPaths.java +++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletPaths.java @@ -1,28 +1,31 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.sling.servlets.annotations; import org.apache.sling.api.servlets.ServletResolverConstants; import org.osgi.service.component.annotations.ComponentPropertyType; + /** * Component Property Type (as defined by OSGi DS 1.4) for Sling Servlets. * Takes care of writing the relevant service properties as being used by the Sling Servlet Resolver ({@link ServletResolverConstants}) * to register the annotated servlet component as Sling servlet for a specific path. - * Preferably register Sling servlets by resource type ({@link SlingServletResourceTypes}) though + * Preferably register Sling servlets by resource type ({@link SlingServletResourceTypes}) though * for reasons outlined at <a href="https://sling.apache.org/documentation/the-sling-engine/servlets.html#caveats-when-binding-servlets-by-path"> * Caveats when binding servlets by path</a>. * diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletPathsStrict.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletPathsStrict.java index 0a3597f..4962cbc 100644 --- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletPathsStrict.java +++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletPathsStrict.java @@ -1,33 +1,36 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.sling.servlets.annotations; import org.apache.sling.api.servlets.ServletResolverConstants; import org.osgi.annotation.bundle.Requirement; import org.osgi.service.component.annotations.ComponentPropertyType; + /** * Component Property Type (as defined by OSGi DS 1.4) for Sling Servlets. - * + * * Takes care of writing the relevant service properties as being used by the Sling Servlet Resolver ({@link ServletResolverConstants}) * to register the annotated servlet component as Sling servlet for a specific path, using the strict mode * (defined in <a href="https://issues.apache.org/jira/browse/SLING-8110">SLING-8110</a>) which * optionally takes into account the request's extension, selectors and HTTP method. - * - * Preferably register Sling servlets by resource type ({@link SlingServletResourceTypes}) though + * + * Preferably register Sling servlets by resource type ({@link SlingServletResourceTypes}) though * for reasons outlined at <a href="https://sling.apache.org/documentation/the-sling-engine/servlets.html#caveats-when-binding-servlets-by-path"> * Caveats when binding servlets by path</a>. * @@ -38,11 +41,7 @@ import org.osgi.service.component.annotations.ComponentPropertyType; */ /** Using this requires the SLING-8110 strict mode */ -@Requirement( - namespace="osgi.extender", - name="org.apache.sling.servlets.resolver", - version="1.1") - +@Requirement(namespace = "osgi.extender", name = "org.apache.sling.servlets.resolver", version = "1.1") @ComponentPropertyType public @interface SlingServletPathsStrict { /** @@ -73,7 +72,7 @@ public @interface SlingServletPathsStrict { * This value should NOT BE CHANGED: this annotation makes no sense * if this value is not "true". We don't have a way currently to define * constant values here (SLING-9055) - * + * * @return the "strict" option value */ boolean paths_strict() default true; @@ -94,7 +93,7 @@ public @interface SlingServletPathsStrict { String[] extensions() default {}; /** - * The HTTP request methods supported by the servlet. If specified, the + * The HTTP request methods supported by the servlet. If specified, the * request's method must match this value for the servlet to be selected. * @return the methods(s) * @see <a href="https://tools.ietf.org/html/rfc7231#section-4.3">HTTP 1.1 Spec Methods</a> diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletPrefix.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletPrefix.java index 2213e9c..000b356 100644 --- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletPrefix.java +++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletPrefix.java @@ -1,27 +1,30 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.sling.servlets.annotations; import org.apache.sling.api.servlets.ServletResolverConstants; import org.osgi.service.component.annotations.ComponentPropertyType; + /** * The prefix/index to be used to register this servlet. * Must be used in combination with either {@link SlingServletPaths} or {@link SlingServletResourceTypes}. - * It only is applied as prefix to {@link SlingServletPaths} or {@link SlingServletResourceTypes#resourceTypes()} + * It only is applied as prefix to {@link SlingServletPaths} or {@link SlingServletResourceTypes#resourceTypes()} * in case they do not start with a "/". * * @see <a href="https://sling.apache.org/documentation/the-sling-engine/servlets.html">Sling Servlets</a> diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletResourceTypes.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletResourceTypes.java index 1389a6a..e4e47b9 100644 --- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletResourceTypes.java +++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletResourceTypes.java @@ -1,23 +1,26 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.sling.servlets.annotations; import org.apache.sling.api.servlets.ServletResolverConstants; import org.osgi.service.component.annotations.ComponentPropertyType; + /** * Component Property Type (as defined by OSGi DS 1.4) for Sling Servlets. * Takes care of writing the relevant service properties as being used by the Sling Servlet Resolver ({@link ServletResolverConstants})
