io.liveoak.container.RequestContextDisposerHandler.java Source code

Java tutorial

Introduction

Here is the source code for io.liveoak.container.RequestContextDisposerHandler.java

Source

/*
 * Copyright 2013 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at http://www.eclipse.org/legal/epl-v10.html
 */
package io.liveoak.container;

import io.liveoak.spi.ResourceResponse;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;

public class RequestContextDisposerHandler extends ChannelDuplexHandler {

    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (msg instanceof ResourceResponse) {
            ((ResourceResponse) msg).inReplyTo().requestContext().dispose();
        }

        super.write(ctx, msg, promise);
    }

}