org.apache.struts2.dispatcher

## Class DefaultDispatcherErrorHandler

- java.lang.Object
- - org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler

- All Implemented Interfaces:
    DispatcherErrorHandler

      public class DefaultDispatcherErrorHandler
      extends Object
      implements DispatcherErrorHandler

  Default implementation of `DispatcherErrorHandler` which sends Error Report in devMode or `HttpServletResponse.sendError(int, java.lang.String)` otherwise.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultDispatcherErrorHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected HashMap<String,Object>` | `createReportData(Exception e, List<Throwable> chain)`
    `void` | `handleError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int code, Exception e)` Handle passed error code or exception
    `protected void` | `handleErrorInDevMode(javax.servlet.http.HttpServletResponse response, int code, Exception e)`
    `void` | `init(javax.servlet.ServletContext ctx)` Init instance after creating `Dispatcher`
    `protected void` | `sendErrorResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int code, Exception e)`
    `void` | `setDevMode(String devMode)`
    `void` | `setFreemarkerManager(FreemarkerManager freemarkerManager)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultDispatcherErrorHandler

          public DefaultDispatcherErrorHandler()

  - ### Method Detail

    - #### setFreemarkerManager

          public void setFreemarkerManager(FreemarkerManager freemarkerManager)

    - #### setDevMode

          public void setDevMode(String devMode)

    - #### init

          public void init(javax.servlet.ServletContext ctx)

      Description copied from interface: `DispatcherErrorHandler`
      Init instance after creating `Dispatcher`
      Specified by:
        `init` in interface `DispatcherErrorHandler`
      Parameters:
        `ctx` - current `ServletContext`

    - #### handleError

          public void handleError(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response,
                                  int code,
                                  Exception e)

      Description copied from interface: `DispatcherErrorHandler`
      Handle passed error code or exception
      Specified by:
        `handleError` in interface `DispatcherErrorHandler`
      Parameters:
        `request` - current `HttpServletRequest`
        `response` - current `HttpServletResponse`
        `code` - HTTP Error Code, see `HttpServletResponse` for possible error codes
        `e` - Exception to report

    - #### sendErrorResponse

          protected void sendErrorResponse(javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response,
                                           int code,
                                           Exception e)

    - #### handleErrorInDevMode

          protected void handleErrorInDevMode(javax.servlet.http.HttpServletResponse response,
                                              int code,
                                              Exception e)

    - #### createReportData

          protected HashMap<String,Object> createReportData(Exception e,
                                                            List<Throwable> chain)

Copyright © 2000–2022 Apache Software Foundation. All rights reserved.