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

com.erigir.wrench.ape.http.ApeExceptionHandler Maven / Gradle / Ivy

There is a newer version: 2.2.16+16
Show newest version
package com.erigir.wrench.ape.http;

import com.erigir.wrench.ape.exception.ApeExceptionWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by chrweiss on 7/6/14.
 */
@ControllerAdvice
public class ApeExceptionHandler {
    private static final Logger LOG = LoggerFactory.getLogger(ApeExceptionHandler.class);

    @Resource(name = "scribeExceptionWriter")
    private ApeExceptionWriter scribeExceptionWriter;

    @ExceptionHandler(value = Exception.class)
    public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse resp, Exception ex) {
        scribeExceptionWriter.writeExceptionToResponse(request, resp, ex);
        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy