Package com.facebook.nifty.header.transport

Examples of com.facebook.nifty.header.transport.THeaderTransport


        // Display headers sent by client
        TTransport inputTransport = requestContext.getInputProtocol().getTransport();
        if (inputTransport instanceof THeaderTransport) {
            LOG.info("headers received from the client in the request:");
            THeaderTransport headerTransport = (THeaderTransport) inputTransport;
            for (String key : headerTransport.getReadHeaders().keySet()) {
                LOG.info("header '" + key + "' => '" + headerTransport.getReadHeaders().get(key) + "'");
            }
        }

        // Send some headers back to the client
        TTransport outputTransport = requestContext.getOutputProtocol().getTransport();
        if (outputTransport instanceof THeaderTransport) {
            LOG.info("adding headers to the response");
            THeaderTransport headerTransport = (THeaderTransport) inputTransport;
            headerTransport.setHeader("header_from", "server");
        }
    }
View Full Code Here


        TProtocol outputProtocol = clientManager.getOutputProtocol(client);
        TTransport outputTransport = outputProtocol.getTransport();
        if (outputTransport instanceof THeaderTransport) {
            LOG.info("adding headers to next client request");
            THeaderTransport headerTransport = (THeaderTransport) outputTransport;
            headerTransport.setHeader("header_from", "client");
        }
        else {
            LOG.info("output transport for client was not THeaderTransport, client cannot send headers");
        }

        client.headerUsageExampleMethod();

        TProtocol inputProtocol = clientManager.getInputProtocol(client);
        TTransport inputTransport = inputProtocol.getTransport();
        if (inputTransport instanceof THeaderTransport) {
            LOG.info("headers received from the server in the response:");
            THeaderTransport headerTransport = (THeaderTransport) outputTransport;
            for (String key : headerTransport.getReadHeaders().keySet()) {
                LOG.info("header '" + key + "' => '" + headerTransport.getReadHeaders().get(key) + "'");
            }
        }
        else {
            LOG.info("output transport for client was not THeaderTransport, client cannot send headers");
        }
View Full Code Here

TOP

Related Classes of com.facebook.nifty.header.transport.THeaderTransport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.