You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2022/12/12 11:27:06 UTC
[sling-org-apache-sling-engine] 01/01: SLING-11728 Remove bi-directional dependencies between Engine and Servlets Resolver
This is an automated email from the ASF dual-hosted git repository.
olli pushed a commit to branch SLING-11728
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git
commit e484c75a3b5bc5c1f0cdc04f35252303e6cca7eb
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Dec 12 12:23:31 2022 +0100
SLING-11728 Remove bi-directional dependencies between Engine and Servlets Resolver
* switch from org.apache.sling.engine.servlets.ErrorHandler to org.apache.sling.api.servlets.ErrorHandler
* remove org.apache.sling.engine.servlets.ErrorHandler
---
pom.xml | 2 +-
.../org/apache/sling/engine/EngineConstants.java | 2 +-
.../sling/engine/impl/DefaultErrorHandler.java | 2 +-
.../engine/impl/SlingRequestProcessorImpl.java | 2 +-
.../engine/impl/filter/ErrorFilterChainStatus.java | 2 +-
.../impl/filter/ErrorFilterChainThrowable.java | 2 +-
.../apache/sling/engine/servlets/ErrorHandler.java | 72 ----------------------
.../apache/sling/engine/servlets/package-info.java | 2 +-
.../sling/engine/impl/DefaultErrorHandlerTest.java | 2 +-
9 files changed, 8 insertions(+), 80 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1ff4f6f..6f799fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,7 +122,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.26.0</version>
+ <version>2.27.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/src/main/java/org/apache/sling/engine/EngineConstants.java b/src/main/java/org/apache/sling/engine/EngineConstants.java
index 66899fd..cb1b340 100644
--- a/src/main/java/org/apache/sling/engine/EngineConstants.java
+++ b/src/main/java/org/apache/sling/engine/EngineConstants.java
@@ -227,7 +227,7 @@ public class EngineConstants {
* Filter scope value identifying an error level filter.
* <p>
* Error level filters are called before calling the
- * {@link org.apache.sling.engine.servlets.ErrorHandler} due to either a
+ * {@link org.apache.sling.api.servlets.ErrorHandler} due to either a
* <code>HttpServletResponse.sendError</code> call or due to an uncaught
* <code>Throwable</code>. The order of calling the filters is defined by
* the <code>service.ranking</code> (or {@link #FILTER_ORDER}) property and
diff --git a/src/main/java/org/apache/sling/engine/impl/DefaultErrorHandler.java b/src/main/java/org/apache/sling/engine/impl/DefaultErrorHandler.java
index d9f6117..1dbceef 100644
--- a/src/main/java/org/apache/sling/engine/impl/DefaultErrorHandler.java
+++ b/src/main/java/org/apache/sling/engine/impl/DefaultErrorHandler.java
@@ -31,7 +31,7 @@ import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.request.RequestProgressTracker;
import org.apache.sling.api.request.ResponseUtil;
-import org.apache.sling.engine.servlets.ErrorHandler;
+import org.apache.sling.api.servlets.ErrorHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java b/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
index e6ad5c0..1591cac 100644
--- a/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
+++ b/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
@@ -65,7 +65,7 @@ import org.apache.sling.engine.impl.filter.SlingComponentFilterChain;
import org.apache.sling.engine.impl.parameters.ParameterSupport;
import org.apache.sling.engine.impl.request.ContentData;
import org.apache.sling.engine.impl.request.RequestData;
-import org.apache.sling.engine.servlets.ErrorHandler;
+import org.apache.sling.api.servlets.ErrorHandler;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Modified;
diff --git a/src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChainStatus.java b/src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChainStatus.java
index 4f0998f..dac58a4 100644
--- a/src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChainStatus.java
+++ b/src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChainStatus.java
@@ -24,7 +24,7 @@ import javax.servlet.ServletException;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.engine.servlets.ErrorHandler;
+import org.apache.sling.api.servlets.ErrorHandler;
public class ErrorFilterChainStatus extends AbstractSlingFilterChain {
diff --git a/src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChainThrowable.java b/src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChainThrowable.java
index 5d5f750..52f7523 100644
--- a/src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChainThrowable.java
+++ b/src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChainThrowable.java
@@ -24,7 +24,7 @@ import javax.servlet.ServletException;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.engine.servlets.ErrorHandler;
+import org.apache.sling.api.servlets.ErrorHandler;
public class ErrorFilterChainThrowable extends AbstractSlingFilterChain {
diff --git a/src/main/java/org/apache/sling/engine/servlets/ErrorHandler.java b/src/main/java/org/apache/sling/engine/servlets/ErrorHandler.java
deleted file mode 100644
index 517fc97..0000000
--- a/src/main/java/org/apache/sling/engine/servlets/ErrorHandler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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
- *
- * 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.engine.servlets;
-
-import java.io.IOException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * The <code>ErrorHandler</code> defines the interface of the service used by
- * the Sling to handle calls to <code>HttpServletResponse.sendError</code> and
- * to handle uncaught <code>Throwable</code>s.
- */
-@ConsumerType
-public interface ErrorHandler {
-
- /**
- * Called to render a response for a HTTP status code. This method should
- * set the response status and print the status code and optional message.
- * <p>
- * If the response has already been committed, an error message should be
- * logged but no further processing should take place.
- *
- * @param status The HTTP status code to set
- * @param message An optional message to write to the response. This message
- * may be <code>null</code>.
- * @param request The request object providing more information on the
- * request.
- * @param response The response object used to send the status and message.
- * @throws IOException May be thrown if an error occurrs sending the
- * response.
- */
- void handleError(int status, String message,
- SlingHttpServletRequest request, SlingHttpServletResponse response)
- throws IOException;
-
- /**
- * Called to render a response for an uncaught <code>Throwable</code>.
- * <p>
- * If the response has already been committed, an error message should be
- * logged but no further processing should take place.
- *
- * @param throwable The <code>Throwable</code> causing this method to be
- * called.
- * @param request The request object providing more information on the
- * request.
- * @param response The response object used to send the status and message.
- * @throws IOException May be thrown if an error occurrs sending the
- * response.
- */
- void handleError(Throwable throwable, SlingHttpServletRequest request,
- SlingHttpServletResponse response) throws IOException;
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/engine/servlets/package-info.java b/src/main/java/org/apache/sling/engine/servlets/package-info.java
index a4511e1..80f497d 100644
--- a/src/main/java/org/apache/sling/engine/servlets/package-info.java
+++ b/src/main/java/org/apache/sling/engine/servlets/package-info.java
@@ -17,7 +17,7 @@
* under the License.
*/
-@org.osgi.annotation.versioning.Version("2.0.9")
+@org.osgi.annotation.versioning.Version("3.0.0")
package org.apache.sling.engine.servlets;
diff --git a/src/test/java/org/apache/sling/engine/impl/DefaultErrorHandlerTest.java b/src/test/java/org/apache/sling/engine/impl/DefaultErrorHandlerTest.java
index be48632..7974d07 100644
--- a/src/test/java/org/apache/sling/engine/impl/DefaultErrorHandlerTest.java
+++ b/src/test/java/org/apache/sling/engine/impl/DefaultErrorHandlerTest.java
@@ -27,7 +27,7 @@ import static org.mockito.Mockito.times;
import java.io.IOException;
import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.engine.servlets.ErrorHandler;
+import org.apache.sling.api.servlets.ErrorHandler;
import org.junit.Test;
import org.mockito.Mockito;