首页>代码>SpringBoot+Mybatis+thymeleaf搭建开源个人博客系统>/blog/src/main/java/springboot/client/handler/HttpClientInitializer.java
package springboot.client.handler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpRequestEncoder;
import io.netty.handler.codec.http.HttpResponseDecoder;
import springboot.client.codec.HttpJsonRequestEncoder;
import springboot.client.codec.HttpJsonResponseDecoder;
import springboot.client.handler.ClientHandler;
import springboot.modal.vo.UserVo;


public class HttpClientInitializer extends ChannelInitializer<SocketChannel>{
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ch.pipeline().addLast("http-decoder",new HttpResponseDecoder());
        ch.pipeline().addLast("http-aggregator",new HttpObjectAggregator(65536));
        ch.pipeline().addLast("json-decoder",new HttpJsonResponseDecoder(UserVo.class));

        ch.pipeline().addLast("http-encoder",new HttpRequestEncoder());
        ch.pipeline().addLast("json-encoder",new HttpJsonRequestEncoder());
        ch.pipeline().addLast("handler",new ClientHandler());
    }
}
最近下载更多
zhouenyi  LV6 3月20日
酒酒清欢  LV8 2023年12月5日
微信网友_6724618780348416  LV3 2023年12月4日
yqyqyqyqy  LV4 2023年7月23日
3416059514  LV1 2023年6月23日
try8023  LV18 2023年5月4日
ycyycy  LV1 2022年10月24日
zxc131313  LV12 2022年10月22日
微信网友_6152246112423936  LV1 2022年9月28日
xingbing  LV9 2022年9月5日
最近浏览更多
zhouenyi  LV6 3月20日
lichengai  LV7 2月26日
pangzhihui  LV12 2月15日
赵明磊 1月18日
暂无贡献等级
cc7777 2023年12月25日
暂无贡献等级
fff2003  LV6 2023年12月19日
空中飞尘  LV13 2023年12月13日
酒酒清欢  LV8 2023年12月5日
微信网友_6724618780348416  LV3 2023年12月4日
chenlie  LV2 2023年11月21日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友