src/main/java/com/jmsoftware/datastructuresandalgorithms/common/util/ResponseUtil.java
/**
     * Render json.
     *
     * @param response   the response
     * @param httpStatus the http status
     * @param message    the message
     */
Render json.
@param response   the response
@param httpStatus the http status
@param message    the message
Render json . @param response the response @param httpStatus the http status @param message the message
public static void renderJson(final HttpServletResponse response, final HttpStatus httpStatus,
                                  final String message) {
        standardizeHttpServletResponse(response, httpStatus);
        val responseBodyBean = ResponseBodyBean.ofStatus(httpStatus.getCode(), message, null);
        try {
            response.getWriter().write(MAPPER.writeValueAsString(responseBodyBean));
        } catch (IOException e) {
            log.error("Error occurred when responding a data JSON.", e);
        }
    }
public static void renderJson ( final HttpServletResponse response , final HttpStatus httpStatus , final String message ) { standardizeHttpServletResponse ( response , httpStatus ) ; val responseBodyBean = ResponseBodyBean . ofStatus ( httpStatus . getCode ( ) , message , null ) ; try { response . getWriter ( ) . write ( MAPPER . writeValueAsString ( responseBodyBean ) ) ; } catch ( IOException e ) { log . error ( "Error occurred when responding a data JSON." , e ) ; } }
Render json.
Render json .