// Path: netty-http/src/main/java/http/elasticaction/RestResponse.java
// public class RestResponse {
// 
//     private HttpRequest httpRequest;
//     private Object body;
// 
//     public Object getBody() {
//         return body;
//     }
// 
//     public void setBody(Object body) {
//         this.body = body;
//     }
// 
//     public HttpRequest getHttpRequest() {
//         return httpRequest;
//     }
// 
//     public void setHttpRequest(HttpRequest httpRequest) {
//         this.httpRequest = httpRequest;
//     }
// }


import com.google.gson.Gson;
import http.elasticaction.RestResponse;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.util.CharsetUtil;
import io.netty.util.ReferenceCountUtil;
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH;
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE;
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;

package http;



/**
 * Created by i311352 on 2/14/2017.
 */
public class HttpSearchResponseHandler extends ChannelOutboundHandlerAdapter {
    Gson gson = new Gson();

    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (msg instanceof HttpResponse) {
            super.write(ctx, msg, promise);
            return;
        }


// Path: netty-http/src/main/java/http/elasticaction/RestResponse.java
// public class RestResponse {
// 
//     private HttpRequest httpRequest;
//     private Object body;
// 
//     public Object getBody() {
//         return body;
//     }
// 
//     public void setBody(Object body) {
//         this.body = body;
//     }
// 
//     public HttpRequest getHttpRequest() {
//         return httpRequest;
//     }
// 
//     public void setHttpRequest(HttpRequest httpRequest) {
//         this.httpRequest = httpRequest;
//     }
// }


// Path: netty-http/src/main/java/http/HttpSearchResponseHandler.java
import com.google.gson.Gson;
import http.elasticaction.RestResponse;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.util.CharsetUtil;
import io.netty.util.ReferenceCountUtil;
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH;
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE;
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;

package http;



/**
 * Created by i311352 on 2/14/2017.
 */
public class HttpSearchResponseHandler extends ChannelOutboundHandlerAdapter {
    Gson gson = new Gson();

    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (msg instanceof HttpResponse) {
            super.write(ctx, msg, promise);
            return;
        }


        RestResponse response = (RestResponse) msg;
