1 // ========================================================================
2 // Copyright (c) 2010-2011 Mort Bay Consulting Pty. Ltd.
3 // ------------------------------------------------------------------------
4 // All rights reserved. This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v1.0
6 // and Apache License v2.0 which accompanies this distribution.
7 // The Eclipse Public License is available at
8 // http://www.eclipse.org/legal/epl-v10.html
9 // The Apache License v2.0 is available at
10 // http://www.opensource.org/licenses/apache2.0.php
11 // You may elect to redistribute this code under either of these licenses.
12 // ========================================================================
13 package org.eclipse.jetty.osgi.httpservice;
14
15 import javax.servlet.http.HttpServlet;
16
17 /**
18 * For jetty agnostic handling of errors issued by the HttpService.
19 * Pass a servlet to the method setHttpServiceErrorHandler.
20 * In the servlet to read the status code of the error or the message or the exception,
21 * use org.eclipse.jetty.server.Dispatch's constants:
22 * int errorCode = httpServletRequest.getAttribute(Dispatcher.ERROR_STATUS_CODE)
23 * for example.
24 */
25 public class HttpServiceErrorHandlerHelper
26 {
27 private static HttpServlet _customErrorHandler;
28
29 public static HttpServlet getCustomErrorHandler()
30 {
31 return _customErrorHandler;
32 }
33
34 public static void setHttpServiceErrorHandler(HttpServlet servlet)
35 {
36 _customErrorHandler = servlet;
37 }
38
39 }