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

com.fasterxml.jackson.jakarta.rs.base.JsonParseExceptionMapper Maven / Gradle / Ivy

There is a newer version: 2.18.2
Show newest version
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