Class WebServiceExceptions

java.lang.Object
org.openremote.container.web.WebServiceExceptions

public class WebServiceExceptions extends Object
Unified exception handling for all web services (Resteasy, Undertow, Servlets, WebSockets).

This is naturally quite messy, our goal is to disable all the other default exception handling and do it here in a "simple" way.

In production we want to be INFOrmed of exceptions but only log a stacktrace if FINE debug logging is enabled. We never want to send a stacktrace or some crappy HTML to a client in production.

TODO: Fine-grained logging for exception, filter which should be logged at INFO or WARN in production TODO: Websocket session errors

  • Constructor Details

    • WebServiceExceptions

      public WebServiceExceptions()
  • Method Details

    • handleResteasyException

      public static jakarta.ws.rs.core.Response handleResteasyException(boolean devMode, String origin, jakarta.ws.rs.core.Request request, jakarta.ws.rs.core.UriInfo uriInfo, Throwable throwable)
    • handleUndertowException

      public static void handleUndertowException(boolean devMode, String origin, boolean logOnly, io.undertow.server.HttpServerExchange exchange, Throwable throwable)
    • renderDevModeError

      public static String renderDevModeError(int statusCode, Throwable t)
    • renderProductionError

      public static String renderProductionError(int statusCode, Throwable t)
    • logException

      public static void logException(Throwable throwable, String origin, String info)
    • getRootCause

      public static Throwable getRootCause(Throwable throwable)
    • getCause

      public static Throwable getCause(Throwable throwable)