protected HttpEntity createHttpEntity(Object o) { return new JacksonableEntity(o, objectMapper); }
/** * Creates new instance of this class. * * @param ser input * @param bufferize tells whether the content should be * stored in an internal buffer * @throws java.io.IOException in case of an I/O error */ public JacksonableEntity(final Object ser, final boolean bufferize, final ObjectMapper objectMapper) { super(); Assert.notNull(ser, "Source object"); this.objectMapper = objectMapper; this.objRef = ser; if (bufferize) { try { createBytes(ser); } catch (IOException e) { throw Exceptions.propagate(e); } } setContentType("application/json"); }
public InputStream getContent() throws IOException, IllegalStateException { if (this.objSer == null) { createBytes(this.objRef); } return new ByteArrayInputStream(this.objSer); }
protected HttpEntity createHttpEntity(Object o) { return new JacksonableEntity(o, objectMapper); }