Package org.apache.vysper.xmpp.protocol

Examples of org.apache.vysper.xmpp.protocol.StanzaHandler


        if (stanza == null) throw new RuntimeException("cannot process NULL stanzas");

        XMPPCoreStanza xmppStanza = XMPPCoreStanza.getWrapper(stanza);
        if (xmppStanza == null) throw new RuntimeException("cannot process only: IQ, message or presence");

        StanzaHandler stanzaHandler = handlers.get(xmppStanza);

        if (stanzaHandler == null) {
            unhandledStanza(stanza);
            return;
        }

        ResponseStanzaContainer responseStanzaContainer = null;
        try {
            responseStanzaContainer = stanzaHandler.execute(stanza, serverRuntimeContext, false, sessionContext, sessionStateHolder);
        } catch (ProtocolException e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }

        if (responseStanzaContainer != null && responseStanzaContainer.getResponseStanza() != null) {
View Full Code Here


        }

    if (terminationCause == SessionTerminationCause.CLIENT_BYEBYE ||
            terminationCause == SessionTerminationCause.CONNECTION_ABORT) {
            Stanza unavailableStanza = StanzaBuilder.createUnavailablePresenceStanza(null, terminationCause);
            StanzaHandler handler = serverRuntimeContext.getHandler(unavailableStanza);
            try {
                handler.execute(unavailableStanza, serverRuntimeContext, true, this, sessionStateHolder);
            } catch (ProtocolException e) {
                logger.error("Failed to send unavailable stanza on connection close", e);
            }
        } else if (terminationCause == SessionTerminationCause.SERVER_SHUTDOWN) {
            // do nothing
View Full Code Here

                if (receivingSession.getState() != SessionState.AUTHENTICATED) {
                    relayResult.addProcessingError(new DeliveryException("no relay to non-authenticated sessions"));
                    continue;
                }
                try {
                    StanzaHandler stanzaHandler = receivingSession.getServerRuntimeContext().getHandler(stanza);
                    INBOUND_STANZA_PROTOCOL_WORKER.processStanza(receivingSession, sessionStateHolder, stanza, stanzaHandler);
                } catch (Exception e) {
                    relayResult.addProcessingError(new DeliveryException("no relay to non-authenticated sessions"));
                    continue;
                }
View Full Code Here

                 if (sessionContext.getState() != SessionState.AUTHENTICATED) {
                     relayResult.addProcessingError(new DeliveryException("no relay to non-authenticated sessions"));
                     continue;
                 }
                 try {
                     StanzaHandler stanzaHandler = sessionContext.getServerRuntimeContext().getHandler(stanza);
                     INBOUND_STANZA_PROTOCOL_WORKER.processStanza(sessionContext, sessionStateHolder, stanza, stanzaHandler);
                 } catch (Exception e) {
                     relayResult.addProcessingError(new DeliveryException(e));
                 }
             }
View Full Code Here

        XMLElement firstInnerElement = stanza;
        if (stanza.getVerifier().subElementsPresentExact(1)) {
            firstInnerElement = stanza.getFirstInnerElement();
        }

        StanzaHandler stanzaHandler = getHandlerForElement(stanza, firstInnerElement);

        if (stanzaHandler == null)
            stanzaHandler = defaultHandlers.get(stanza);

        return stanzaHandler;
View Full Code Here

        XMPPCoreStanza xmppStanza = XMPPCoreStanza.getWrapper(stanza);
        if (xmppStanza == null)
            throw new RuntimeException("cannot process only: IQ, message or presence");

        StanzaHandler stanzaHandler = componentStanzaHandlerLookup.getHandler(xmppStanza);

        if (stanzaHandler == null) {
            unhandledStanza(stanza);
            return;
        }

        ResponseStanzaContainer responseStanzaContainer = null;
        try {
            responseStanzaContainer = stanzaHandler.execute(stanza, serverRuntimeContext, false, sessionContext,
                    sessionStateHolder);
        } catch (ProtocolException e) {
            e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
        }
View Full Code Here

        }

        if (terminationCause == SessionTerminationCause.CLIENT_BYEBYE
                || terminationCause == SessionTerminationCause.CONNECTION_ABORT) {
            Stanza unavailableStanza = StanzaBuilder.createUnavailablePresenceStanza(null, terminationCause);
            StanzaHandler handler = serverRuntimeContext.getHandler(unavailableStanza);
            try {
                handler.execute(unavailableStanza, serverRuntimeContext, true, this, sessionStateHolder);
            } catch (ProtocolException e) {
                logger.error("Failed to send unavailable stanza on connection close", e);
            }
        } else if (terminationCause == SessionTerminationCause.SERVER_SHUTDOWN) {
            // do nothing
View Full Code Here

                if (receivingSession.getState() != SessionState.AUTHENTICATED) {
                    relayResult.addProcessingError(new DeliveryException("no relay to non-authenticated sessions"));
                    continue;
                }
                try {
                    StanzaHandler stanzaHandler = receivingSession.getServerRuntimeContext().getHandler(stanza);
                    INBOUND_STANZA_PROTOCOL_WORKER.processStanza(receivingSession, sessionStateHolder, stanza,
                            stanzaHandler);
                } catch (Exception e) {
                    relayResult.addProcessingError(new DeliveryException("no relay to non-authenticated sessions"));
                    continue;
View Full Code Here

                if (sessionContext.getState() != SessionState.AUTHENTICATED) {
                    relayResult.addProcessingError(new DeliveryException("no relay to non-authenticated sessions"));
                    continue;
                }
                try {
                    StanzaHandler stanzaHandler = sessionContext.getServerRuntimeContext().getHandler(stanza);
                    INBOUND_STANZA_PROTOCOL_WORKER.processStanza(sessionContext, sessionStateHolder, stanza,
                            stanzaHandler);
                } catch (Exception e) {
                    relayResult.addProcessingError(new DeliveryException(e));
                }
View Full Code Here

                if (receivingSession.getState() != SessionState.AUTHENTICATED) {
                    relayResult.addProcessingError(new DeliveryException("no relay to non-authenticated sessions"));
                    continue;
                }
                try {
                    StanzaHandler stanzaHandler = receivingSession.getServerRuntimeContext().getHandler(stanza);
                    INBOUND_STANZA_PROTOCOL_WORKER.processStanza(receivingSession, sessionStateHolder, stanza,
                            stanzaHandler);
                } catch (Exception e) {
                    relayResult.addProcessingError(new DeliveryException("no relay to non-authenticated sessions"));
                    continue;
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.protocol.StanzaHandler

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.