public static Response getStatusResponse ( Response . Status status , String ... messages ) { if ( status == null ) { return Response . status ( Response . Status . BAD_REQUEST ) . build ( ) ; } String msg = StringUtils . join ( messages , ". " ) ; if ( StringUtils . isBlank ( msg ) ) { msg = status . getReasonPhrase ( ) ; } try { return GenericExceptionMapper . getExceptionResponse ( status . getStatusCode ( ) , msg ) ; } catch ( Exception ex ) { logger . error ( null , ex ) ; return Response . status ( Response . Status . BAD_REQUEST ) . build ( ) ; } }
A generic JSON response handler .