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

org.javawebstack.httpserver.handler.ExceptionHandler Maven / Gradle / Ivy

Go to download

This library provides a routing and request mapping stack on top of the well known and industry proven eclipse jetty http server. It also supports websockets.

The newest version!
package org.javawebstack.httpserver.handler;

import org.javawebstack.httpserver.Exchange;

import java.util.logging.Level;

public interface ExceptionHandler {
    Object handle(Exchange exchange, Throwable ex);

    class DefaultExceptionHandler implements ExceptionHandler {
        public Object handle(Exchange exchange, Throwable ex) {
            exchange.getServer().getLogger().log(Level.SEVERE, ex, () -> "An internal server error occured!");
            return "An internal server error occured! Please contact the server administrator in case you think this is a problem.";
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy