Java Code Examples for javax.ws.rs.BadRequestException#getMessage()

The following examples show how to use javax.ws.rs.BadRequestException#getMessage() . 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: BadRequestExceptionMapper.java    From jweb-cms with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public Response toResponse(BadRequestException e) {
    ExceptionResponse response = new ExceptionResponse();
    response.errorMessage = e.getMessage();
    return Response.status(Response.Status.METHOD_NOT_ALLOWED).entity(response)
        .type(MediaType.APPLICATION_JSON).build();
}
 
Example 2
Source File: BadRequestExceptionMapper.java    From attic-stratos with Apache License 2.0 5 votes vote down vote up
public Response toResponse(BadRequestException badRequestException) {
    if (log.isDebugEnabled()) {
        log.debug("Error in input format", badRequestException);
    }
    String errorMsg = badRequestException.getMessage() != null ? badRequestException.getMessage() : "please check" +
            "your input format";
    return Response.status(Response.Status.BAD_REQUEST).type(MediaType.APPLICATION_JSON).
            entity(MockIaasApiUtils.buildMessage(Response.Status.BAD_REQUEST.getStatusCode(), errorMsg)).build();
}
 
Example 3
Source File: BadRequestExceptionMapper.java    From attic-stratos with Apache License 2.0 5 votes vote down vote up
public Response toResponse(BadRequestException badRequestException) {
    if (log.isDebugEnabled()) {
        log.debug("Error in input format", badRequestException);
    }
    String errorMsg = badRequestException.getMessage() != null ? badRequestException.getMessage() : "please check" +
            "your input format";
    return Response.status(Response.Status.BAD_REQUEST).type(MediaType.APPLICATION_JSON).
            entity(new ResponseMessageBean(ResponseMessageBean.ERROR, errorMsg)).build();
}
 
Example 4
Source File: BadRequestExceptionMapper.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
@Override
protected String getErrorMessage(BadRequestException exception) {
    return exception.getMessage();
}