public static void returnStatusResponse ( HttpServletResponse response , int status , String message ) { if ( response == null ) { return ; } PrintWriter out = null ; try { response . setStatus ( status ) ; response . setContentType ( MediaType . APPLICATION_JSON ) ; out = response . getWriter ( ) ; ParaObjectUtils . getJsonWriter ( ) . writeValue ( out , getStatusResponse ( Response . Status . fromStatusCode ( status ) , message ) . getEntity ( ) ) ; } catch ( Exception ex ) { logger . error ( null , ex ) ; } finally { if ( out != null ) { out . close ( ) ; } } }
A generic JSON response handler . Returns a message and response code .