com.github.t1.problemdetail.spring.ProblemDetailControllerAdvice Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of problem-details-ri-spring Show documentation
Show all versions of problem-details-ri-spring Show documentation
Problem Detail implementation for Spring Boot
package com.github.t1.problemdetail.spring;
import com.github.t1.problemdetail.ri.lib.ProblemDetails;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestClientResponseException;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.Response.StatusType;
import java.util.Enumeration;
/**
* Maps exceptions to a response with a body containing problem details
* as specified in https://tools.ietf.org/html/rfc7807
*/
@Slf4j
@ControllerAdvice
public class ProblemDetailControllerAdvice {
@ExceptionHandler(Exception.class)
@ResponseBody ResponseEntity
© 2015 - 2024 Weber Informatics LLC | Privacy Policy