@Test public void testmarshalStreamWithOK() throws IOException { final String body = "{\"prop\":\"test\"}"; final TestBody testBody = om.readValue(body, TestBody.class); final HttpContent result = eventRequestMarshaller.marshallResponsePart(testBody, HttpResponseStatus.OK, true); final ByteBuf jsonBuf = result.content(); final String jsonStr = jsonBuf.toString(CharsetUtil.UTF_8); assertNotNull("response shouldn't be null", result); assertEquals("data not equals", "data: " + body + "\n\n", jsonStr); }
@Override public HttpContent marshallResponsePart(Object message, HttpResponseStatus status, boolean rawStream) throws IOException { final String content = "data: " + om.writeValueAsString(message) + "\n\n"; final ByteBuf buf = Unpooled.copiedBuffer(content, CharsetUtil.UTF_8); final DefaultHttpContent defaultHttpContent = new DefaultHttpContent(buf); return defaultHttpContent; }
EventRequestMarshaller extends JsonRequestMarshaller { @Override public HttpContent marshallResponsePart(Object message, HttpResponseStatus status, boolean rawStream) throws IOException { final String content = "data: " + om.writeValueAsString(message) + "\n\n"; final ByteBuf buf = Unpooled.copiedBuffer(content, CharsetUtil.UTF_8); final DefaultHttpContent defaultHttpContent = new DefaultHttpContent(buf); return defaultHttpContent; } }
EventRequestMarshaller extends JsonRequestMarshaller { @Override public HttpContent marshallResponsePart(Object message, HttpResponseStatus status, boolean rawStream) throws IOException { final String content = "data: " + om.writeValueAsString(message) + "\n\n"; final ByteBuf buf = Unpooled.copiedBuffer(content, CharsetUtil.UTF_8); final DefaultHttpContent defaultHttpContent = new DefaultHttpContent(buf); return defaultHttpContent; }  }
EventRequestMarshaller extends JsonRequestMarshaller { @Override public HttpContent marshallResponsePart(Object message, HttpResponseStatus status, boolean rawStream) throws IOException { final String content = "data: " + om.writeValueAsString(message) + "\n\n"; final ByteBuf buf = Unpooled.copiedBuffer(content, CharsetUtil.UTF_8); final DefaultHttpContent defaultHttpContent = new DefaultHttpContent(buf); return defaultHttpContent; }  @Override HttpContent marshallResponsePart(Object message, HttpResponseStatus status, boolean rawStream); @Override HttpResponse marshallResponseHeaders(final boolean rawStream); }
EventRequestMarshaller extends JsonRequestMarshaller { @Override public HttpContent marshallResponsePart(Object message, HttpResponseStatus status, boolean rawStream) throws IOException { final String content = "data: " + om.writeValueAsString(message) + "\n\n"; final ByteBuf buf = Unpooled.copiedBuffer(content, CharsetUtil.UTF_8); final DefaultHttpContent defaultHttpContent = new DefaultHttpContent(buf); return defaultHttpContent; }  @Override HttpContent marshallResponsePart(Object message, HttpResponseStatus status, boolean rawStream); @Override HttpResponse marshallResponseHeaders(final boolean rawStream);  }