org.jboss.resteasy.spi.ReaderException Java Examples

The following examples show how to use org.jboss.resteasy.spi.ReaderException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReaderExceptionMapper.java    From monolith with Apache License 2.0 5 votes vote down vote up
@Override
public Response toResponse(ReaderException exception) {
    Map<String, Object> responseEntity = new HashMap<String, Object>();
    responseEntity.put("errors", Collections.singletonList("The submitted request is invalid. Please retry after correcting the input values."));
    return Response.status(Response.Status.BAD_REQUEST).
            entity(responseEntity).
            type(headers.getMediaType()).
            build();
}
 
Example #2
Source File: ReaderExceptionMapper.java    From monolith with Apache License 2.0 5 votes vote down vote up
@Override
public Response toResponse(ReaderException exception) {
    Map<String, Object> responseEntity = new HashMap<String, Object>();
    responseEntity.put("errors", Collections.singletonList("The submitted request is invalid. Please retry after correcting the input values."));
    return Response.status(Response.Status.BAD_REQUEST).
            entity(responseEntity).
            type(headers.getMediaType()).
            build();
}
 
Example #3
Source File: ReaderExceptionMapper.java    From monolith with Apache License 2.0 5 votes vote down vote up
@Override
public Response toResponse(ReaderException exception) {
    Map<String, Object> responseEntity = new HashMap<String, Object>();
    responseEntity.put("errors", Collections.singletonList("The submitted request is invalid. Please retry after correcting the input values."));
    return Response.status(Response.Status.BAD_REQUEST).
            entity(responseEntity).
            type(headers.getMediaType()).
            build();
}
 
Example #4
Source File: ReaderExceptionMapper.java    From hawkular-metrics with Apache License 2.0 5 votes vote down vote up
@Override
public Response toResponse(ReaderException exception) {
    Throwable rootCause = Throwables.getRootCause(exception);
    if (rootCause instanceof EmptyPayloadException) {
        return ApiUtils.emptyPayload();
    }
    return ExceptionMapperUtils.buildResponse(rootCause, Response.Status.BAD_REQUEST);
}