Package org.apache.geronimo.interop.rmi.iiop

Examples of org.apache.geronimo.interop.rmi.iiop.CdrInputStream


        if (!clientHostAddress.equals(clientHostName)) {
            clientInfo += " (" + clientHostAddress + ")";
        }

        boolean firstMessage = true;
        CdrInputStream input = CdrInputStream.getInstance();
        CdrOutputStream output = CdrOutputStream.getInstance();
        CdrOutputStream results = CdrOutputStream.getInstance();

        for (; ;) {
            boolean sendResponse = true;
            GiopMessage inputMessage;

            try {
                inputMessage = input.receive_message( in, clientInfo );
                firstMessage = false;
            } catch (BadMagicException ex) {
                if (firstMessage) {
                    warnBadMagic(clientInfo, ex);
                } else {
                    warnBadMagicBadSize(clientInfo, ex);
                }
                closeStreams( in, out );
                return;
            } catch (UnsupportedProtocolVersionException ex) {
                warnGiopVersion( clientInfo, ex);
                closeStreams( in, out );
                return;
            } catch (Exception ex) {
                if (input.getOffset() > 0) {
                    ex.printStackTrace();
                    warnReceiveFailed( clientInfo, ex);
                }
                // Otherwise client shutdown was not in the middle of a
                // request, i.e. probably 'normal' and unworthy of a
                // log message.
                closeStreams( in, out );
                return;
            }

            output.setGiopVersion(input.getGiopVersion());

            switch (inputMessage.type) {
                case MsgType_1_1._Request:
                    processRequest(input, output, results, inputMessage.request, clientInfo);
                    if ((inputMessage.request.response_flags & 1) == 0) {
                        sendResponse = false; // oneway request
                    }
                    break;
                case MsgType_1_1._LocateRequest:
                    processLocateRequest(output, inputMessage.locateRequest);
                    break;
                default:
                    throw new SystemException("TODO: message type = " + inputMessage.type);
            }

            if (sendResponse) {
                try {
                    if(inputMessage.httpTunneling)
                    {
                        output.send_http_response( out, clientInfo );
                    }
                    else
                    {
                        output.send_message( out, clientInfo );
                    }
                } catch (Exception ex) {
                    warnSendFailed(clientInfo, ex);
                    closeStreams( in, out );
                    return;
                }
            }

            input.reset();
            output.reset();
            results.reset();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.interop.rmi.iiop.CdrInputStream

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.