@@ -0,0 +1,2018 @@
+package com.outbrain.ob1k.common.marshalling;%0A%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0Aimport io.netty.buffer.ByteBuf;%0Aimport io.netty.buffer.Unpooled;%0Aimport io.netty.handler.codec.http.DefaultHttpContent;%0Aimport io.netty.handler.codec.http.DefaultHttpResponse;%0Aimport io.netty.handler.codec.http.HttpContent;%0Aimport io.netty.handler.codec.http.HttpResponse;%0Aimport io.netty.handler.codec.http.HttpResponseStatus;%0Aimport io.netty.handler.codec.http.HttpVersion;%0Aimport io.netty.util.CharsetUtil;%0A%0Aimport java.io.IOException;%0A%0Aimport static io.netty.handler.codec.http.HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN;%0Aimport static io.netty.handler.codec.http.HttpHeaders.Names.CONNECTION;%0Aimport static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_ENCODING;%0Aimport static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE;%0Aimport static io.netty.handler.codec.http.HttpHeaders.Names.TRANSFER_ENCODING;%0Aimport static io.netty.handler.codec.http.HttpHeaders.Values.KEEP_ALIVE;%0A%0Apublic class EventRequestMarshaller extends JsonRequestMarshaller %7B%0A  private final ObjectMapper om = new ObjectMapper();%0A%0A  @Override%0A  public HttpContent marshallResponsePart(Object message, HttpResponseStatus status, boolean rawStream) throws IOException %7B%0A    final String content = %22data: %22 + om.writeValueAsString(message) + %22%5Cn%5Cn%22;%0A    final ByteBuf buf = Unpooled.copiedBuffer(content, CharsetUtil.UTF_8);%0A    final DefaultHttpContent defaultHttpContent = new DefaultHttpContent(buf);%0A    return defaultHttpContent;%0A  %7D%0A%0A  @Override%0A  public HttpResponse marshallResponseHeaders(final boolean rawStream) %7B%0A    final HttpResponse res = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);%0A    res.headers().add(CONNECTION, KEEP_ALIVE);%0A    res.headers().add(CONTENT_TYPE.toLowerCase(), %22text/event-stream%22);%0A    res.headers().add(TRANSFER_ENCODING, %22UTF-8%22);%0A    res.headers().add(CONTENT_ENCODING, %22UTF-8%22);%0A    res.headers().add(ACCESS_CONTROL_ALLOW_ORIGIN, %22*%22);%0A    return res;%0A  %7D%0A%0A%7D%0A

support for server send event - add marsheller