/** * Convenience method for hello world :) * @param s - the content to render as plain text */ protected void renderText(String s) { LOG.debug("{}: {}", MimeType.TEXT, s); context().rendered = true; response().setContentType(MimeType.TEXT); writer().print(s); }
/** * Convenience method for hello world :) * @param s - the content to render as plain text */ protected void renderText(String s) { LOG.debug("{}: {}", MimeType.TEXT, s); context().rendered = true; response().setContentType(MimeType.TEXT); writer().print(s); }
/** * Convenience method for hello world :) * @param s - the content to render as plain text */ protected void renderText(String s) { LOG.debug("{}: {}", MimeType.TEXT, s); context().rendered = true; response().setContentType(MimeType.TEXT); writer().print(s); }
/** * Convenience method for REST APIs (without explicit views) * @param object - the object as the response (in JSON) */ protected void renderJSON(Object object) { LOG.debug("{}: {}", MimeType.JSON, object); context().rendered = true; context().response.setContentType(MimeType.JSON); try { jsonMapper.writeValue(writer(), object); } catch (Exception e) { throw new WebAppException(e); } }
/** * Convenience method for REST APIs (without explicit views) * @param object - the object as the response (in JSON) */ protected void renderJSON(Object object) { LOG.debug("{}: {}", MimeType.JSON, object); context().rendered = true; context().response.setContentType(MimeType.JSON); try { jsonMapper.writeValue(writer(), object); } catch (Exception e) { throw new WebAppException(e); } }
/** * Convenience method for REST APIs (without explicit views) * @param object - the object as the response (in JSON) */ protected void renderJSON(Object object) { LOG.debug("{}: {}", MimeType.JSON, object); context().rendered = true; context().response.setContentType(MimeType.JSON); try { jsonMapper.writeValue(writer(), object); } catch (Exception e) { throw new WebAppException(e); } }
protected void renderJSON(Class<? extends ToJSON> cls) { context().rendered = true; response().setContentType(MimeType.JSON); getInstance(cls).toJSON(writer()); }
protected void renderJSON(Class<? extends ToJSON> cls) { context().rendered = true; response().setContentType(MimeType.JSON); getInstance(cls).toJSON(writer()); }
protected void renderJSON(Class<? extends ToJSON> cls) { context().rendered = true; response().setContentType(MimeType.JSON); getInstance(cls).toJSON(writer()); }