Package org.apache.vysper.xmpp.protocol

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


        // if all is correct, go to next phase
        sessionStateHolder.setState(SessionState.ENCRYPTION_STARTED);

        sessionContext.switchToTLS();

        return new ResponseStanzaContainerImpl(responseStanza);
    }
View Full Code Here


        return new ResponseStanzaContainerImpl(responseStanza);
    }

    private ResponseStanzaContainer respondTLSFailure() {
        return new ResponseStanzaContainerImpl(ServerErrorResponses.getInstance().getTLSFailure());
    }
View Full Code Here

            if (toValue != null) {
                EntityImpl toEntity = null;
                try {
                    toEntity = EntityImpl.parse(toValue);
                } catch (EntityFormatException e) {
                    return new ResponseStanzaContainerImpl(ServerErrorResponses.getInstance().getStreamError(
                            StreamErrorCondition.IMPROPER_ADDRESSING, sessionContext.getXMLLang(),
                            "could not parse incoming stanza's TO attribute", null));

                }
                // TODO check if toEntity is served by this server
                // if (!server.doesServe(toEntity)) throw WhateverException();

                // TODO RFC3920: 'from' attribute SHOULD be silently ignored by the receiving entity
                // TODO RFC3920bis: 'from' attribute SHOULD be not ignored by the receiving entity and used as 'to' in responses
            }
            responseStanza = new ServerResponses().getStreamOpener(clientCall, sessionContext.getServerJID(),
                    responseVersion, sessionContext);
        } else if (serverCall) {
            // RFC3920: 'from' attribute SHOULD be used by the receiving entity
            String fromValue = stanza.getAttributeValue("from");
            if (fromValue != null) {
                EntityImpl entity = null;
                try {
                    entity = EntityImpl.parse(fromValue);
                } catch (EntityFormatException e) {
                    return new ResponseStanzaContainerImpl(ServerErrorResponses.getInstance().getStreamError(
                            StreamErrorCondition.INVALID_FROM, sessionContext.getXMLLang(),
                            "could not parse incoming stanza's FROM attribute", null));

                }
            }
            throw new RuntimeException("server connection not yet supported");
        } else {
            String descriptiveText = "one of the two namespaces must be present: " + NamespaceURIs.JABBER_CLIENT
                    + " or " + NamespaceURIs.JABBER_SERVER;
            return respondIllegalNamespaceError(descriptiveText);
        }

        // if all is correct, go to next phase
        switch (sessionStateHolder.getState()) {

        case AUTHENTICATED:
        case ENCRYPTED:
            // do not change state!
            break;
        default:
            sessionStateHolder.setState(SessionState.STARTED);
        }

        if (responseStanza != null)
            return new ResponseStanzaContainerImpl(responseStanza);

        return null;
    }
View Full Code Here

        return null;
    }

    private ResponseStanzaContainer respondIllegalNamespaceError(String descriptiveText) {
        return new ResponseStanzaContainerImpl(ServerErrorResponses.getInstance().getStreamError(
                StreamErrorCondition.INVALID_NAMESPACE, null, descriptiveText, null));
    }
View Full Code Here

        return new ResponseStanzaContainerImpl(ServerErrorResponses.getInstance().getStreamError(
                StreamErrorCondition.INVALID_NAMESPACE, null, descriptiveText, null));
    }

    private ResponseStanzaContainer respondUnsupportedStanzaType(String descriptiveText) {
        return new ResponseStanzaContainerImpl(ServerErrorResponses.getInstance().getStreamError(
                StreamErrorCondition.UNSUPPORTED_STANZA_TYPE, null, descriptiveText, null));
    }
View Full Code Here

            String errorMessage) {
        if (xmlLang == null)
            xmlLang = "en_US";
        Stanza error = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.UNSUPPORTED_VERSION,
                xmlLang, errorMessage + versionAttributeValue, null);
        return new ResponseStanzaContainerImpl(error);
    }
View Full Code Here

        }

        Entity to = stanza.getTo();
        if (sessionContext != null && sessionContext.isServerToServer() && to == null) {
            // "to" MUST be present for jabber:server
            return new ResponseStanzaContainerImpl(ServerErrorResponses.getInstance().getStreamError(
                    StreamErrorCondition.IMPROPER_ADDRESSING, stanza.getXMLLang(), "missing to attribute", null));
        }

        if (to != null) {
            // TODO ensure, that RFC3920 9.1.1 "If the value of the 'to' attribute is invalid or cannot be contacted..." is enforced
        }

        Stanza responseStanza = executeCore(stanza, serverRuntimeContext, isOutboundStanza, sessionContext);

        if (responseStanza != null)
            return new ResponseStanzaContainerImpl(responseStanza);

        return null;
    }
View Full Code Here

        AuthorizationRetriesCounter counter = AuthorizationRetriesCounter.getFromSession(sessionContext);
        boolean moreTriesLeft = counter.countFailedTry(); // record that client aborted

        // TODO do more clean-ups as mechanism requires.

        return new ResponseStanzaContainerImpl(new ServerResponses().getAuthAborted());
    }
View Full Code Here

        return executeWorker(stanza, sessionContext, sessionStateHolder);
    }

    protected ResponseStanzaContainer respondSASLFailure() {
        return new ResponseStanzaContainerImpl(ServerErrorResponses.getInstance().getSASLFailure(
                SASLFailureType.MALFORMED_REQUEST));
    }
View Full Code Here

            AuthorizationRetriesCounter.removeFromSession(sessionContext);
        } else {
            AuthorizationRetriesCounter.getFromSession(sessionContext).countFailedTry();
        }

        return new ResponseStanzaContainerImpl(responseStanza);
    }
View Full Code Here

TOP

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

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.