class WilmaHttpEntityUtils {

    public boolean isJsonMessage(final WilmaHttpEntity request) {
        boolean isJson;
        String body = null;
        try {
            body = request.getBody();
            new JSONObject(body);
            isJson = true;
        } catch (JSONException ex) {
            logger.debug("Request (" + request.getWilmaMessageLoggerId() + ") body is not of JSON type or has invalid syntax: " + body, ex);
            isJson = false;
        }
        return isJson;
    }

}