com.fasterxml.jackson.jakarta.rs.base.JsonParseExceptionMapper Maven / Gradle / Ivy
package com.fasterxml.jackson.jakarta.rs.base;
import com.fasterxml.jackson.core.JsonParseException;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
/**
* Implementation of {@link ExceptionMapper} to send down a "400 Bad Request"
* in the event unparsable JSON is received.
*/
public class JsonParseExceptionMapper implements ExceptionMapper {
@Override
public Response toResponse(JsonParseException exception) {
return Response.status(Response.Status.BAD_REQUEST).entity(exception.getMessage()).type("text/plain").build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy