All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hanframework.mojito.protocol.http.HttpRequestEncoderWrapper Maven / Gradle / Ivy

There is a newer version: 1.0.2-RELEASE
Show newest version
package com.hanframework.mojito.protocol.http;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.HttpRequestEncoder;

import java.util.List;

/**
 * @author liuxin
 * 2020-09-02 14:33
 */
public class HttpRequestEncoderWrapper extends HttpRequestEncoder {

    @Override
    public boolean acceptOutboundMessage(Object msg) throws Exception {
        return msg instanceof HttpRequestFacade;
    }

    @Override
    protected void encode(ChannelHandlerContext ctx, Object msg, List out) throws Exception {
        if (msg instanceof HttpRequestFacade) {
            msg = ((HttpRequestFacade) msg).getFullHttpRequest();
        }
        super.encode(ctx, msg, out);
    }

}