public static void json() throws RenderJson { Swagger swaggerObject = Swaggerton.get().getSwagger(); if (swaggerObject.getHost() == null) { swaggerObject.setHost(request.host); } try { throw new RenderJson(mapper.writeValueAsString(swaggerObject)); } catch (JsonProcessingException e) { e.printStackTrace(); } }
/** * Render a 200 OK application/json response * @param jsonString The JSON string */ protected static void renderJSON(String jsonString) { throw new RenderJson(jsonString); }
/** * Render a 200 OK application/json response * @param o The Java object to serialize */ protected static void renderJSON(Object o) { throw new RenderJson(o); }
/** * Render a 200 OK application/json response * @param o The Java object to serialize * @param type The Type informations for complex generic types */ protected static void renderJSON(Object o, Type type) { throw new RenderJson(o, type); }
/** * Render a 200 OK application/json response. * @param o The Java object to serialize * @param adapters A set of GSON serializers/deserializers/instance creator to use */ protected static void renderJSON(Object o, JsonSerializer<?>... adapters) { throw new RenderJson(o, adapters); }