@Override public Object serialize(ObjectMapperSerializationContext context) { ContentTypeEngine engine = pippo.getApplication().getContentTypeEngine(context.getContentType()); if (engine == null) { throw new PippoRuntimeException("No ContentTypeEngine registered for {}", context.getContentType()); } return engine.toString(context.getObjectToSerialize()); }
private void send(Object object, String contentType) { if (StringUtils.isNullOrEmpty(contentType)) { throw new PippoRuntimeException("You must specify a content type!"); } ContentTypeEngine contentTypeEngine = contentTypeEngines.getContentTypeEngine(contentType); if (contentTypeEngine == null) { throw new PippoRuntimeException("You must set a content type engine for '{}'", contentType); } header(HttpConstants.Header.CONTENT_TYPE, contentTypeEngine.getContentType()); send(contentTypeEngine.toString(object)); }
@Override public Object serialize(ObjectMapperSerializationContext context) { ContentTypeEngine contentTypeEngine = contentTypeEngines.getContentTypeEngine(context.getContentType()); if (contentTypeEngine == null) { throw new FathomException("No ContentTypeEngine registered for {}", context.getContentType()); } return contentTypeEngine.toString(context.getObjectToSerialize()); } };
@Override public Object serialize(ObjectMapperSerializationContext context) { ContentTypeEngine contentTypeEngine = contentTypeEngines.getContentTypeEngine(context.getContentType()); if (contentTypeEngine == null) { throw new FathomException("No ContentTypeEngine registered for {}", context.getContentType()); } return contentTypeEngine.toString(context.getObjectToSerialize()); } };
@Override public Object serialize(ObjectMapperSerializationContext context) { ContentTypeEngine engine = pippo.getApplication().getContentTypeEngine(context.getContentType()); if (engine == null) { throw new PippoRuntimeException("No ContentTypeEngine registered for {}", context.getContentType()); } return engine.toString(context.getObjectToSerialize()); }
@GET("/") @Consumes({Consumes.HTML}) @Metered public void get() { getResponse() .bind("myDesserts", engines.getContentTypeEngine(Produces.JSON).toString(dao.myDesserts)) .render("content"); }