You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by jo...@apache.org on 2024/10/27 13:13:11 UTC

(sling-org-apache-sling-servlets-resolver) 05/05: add the previous commit message as comment

This is an automated email from the ASF dual-hosted git repository.

joerghoh pushed a commit to branch SLING-12461
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-resolver.git

commit 69e73adacddeb0d8b76e70d69a80c84aa1449a67
Author: Joerg Hoh <jo...@apache.org>
AuthorDate: Sun Oct 27 14:12:48 2024 +0100

    add the previous commit message as comment
---
 .../sling/servlets/resolver/internal/defaults/DefaultServlet.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/servlets/resolver/internal/defaults/DefaultServlet.java b/src/main/java/org/apache/sling/servlets/resolver/internal/defaults/DefaultServlet.java
index fc13383..57809c4 100644
--- a/src/main/java/org/apache/sling/servlets/resolver/internal/defaults/DefaultServlet.java
+++ b/src/main/java/org/apache/sling/servlets/resolver/internal/defaults/DefaultServlet.java
@@ -48,8 +48,10 @@ public class DefaultServlet extends SlingSafeMethodsServlet {
 
         Resource resource = request.getResource();
 
-        // cannot handle the request for missing resources
+        // Also log that this servlet was invoked, as there are circumstances where setting the statuscode
+        // might not have any effect anymore (for example when the response is already committed).
         if (resource instanceof NonExistingResource) {
+            // cannot handle the request for missing resources
             String msg = String.format("Resource not found at path %s", resource.getPath());
             LOG.error(msg);
             response.sendError(HttpServletResponse.SC_NOT_FOUND,msg);