
org.opensearch.migrations.replay.datahandlers.http.NettyJsonBodyConvertHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trafficReplayer Show documentation
Show all versions of trafficReplayer Show documentation
Everything opensearch migrations
package org.opensearch.migrations.replay.datahandlers.http;
import org.opensearch.migrations.transform.IJsonTransformer;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
public class NettyJsonBodyConvertHandler extends ChannelInboundHandlerAdapter {
private final IJsonTransformer transformer;
public NettyJsonBodyConvertHandler(IJsonTransformer transformer) {
this.transformer = transformer;
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HttpJsonMessageWithFaultingPayload) {
var output = transformer.transformJson((HttpJsonMessageWithFaultingPayload) msg);
var newHttpJson = new HttpJsonMessageWithFaultingPayload(output);
ctx.fireChannelRead(newHttpJson);
} else {
super.channelRead(ctx, msg);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy