You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2010/09/13 12:51:45 UTC
svn commit: r996491 -
/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
Author: fmeschbe
Date: Mon Sep 13 10:51:45 2010
New Revision: 996491
URL: http://svn.apache.org/viewvc?rev=996491&view=rev
Log:
SLING-1766 use servlet container error handling to send back the 503 status in case of missing required services (particularly during system startup)
Modified:
sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java?rev=996491&r1=996490&r2=996491&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java (original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java Mon Sep 13 10:51:45 2010
@@ -193,11 +193,17 @@ public class SlingRequestProcessorImpl i
} catch (UnavailableException ue) {
+ // exception is thrown before the SlingHttpServletRequest/Response
+ // is properly set up due to missing dependencies. In this case
+ // we must not use the Sling error handling infrastructure but
+ // just return a 503 status response handled by the servlet
+ // container environment
+
final int status = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
final String errorMessage = ue.getMessage()
+ " service missing, cannot service requests";
log.error("{} , sending status {}", errorMessage, status);
- handleError(status, errorMessage, request, response);
+ servletResponse.sendError(status, errorMessage);
} catch (Throwable t) {