All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.sling.engine.servlets.ErrorHandler Maven / Gradle / Ivy

/*
 * 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 aQute.bnd.annotation.ConsumerType;

/**
 * The ErrorHandler defines the interface of the service used by
 * the Sling to handle calls to HttpServletResponse.sendError and
 * to handle uncaught Throwables.
 */
@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.
     * 

* 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 null. * @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 Throwable. *

* If the response has already been committed, an error message should be * logged but no further processing should take place. * * @param throwable The Throwable 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; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy