Examples of Stanza


Examples of org.apache.vysper.xmpp.stanza.Stanza

*/
public class ResponseWriter {

    public static void writeUnsupportedStanzaError(SessionContext sessionContext) {

        Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.UNSUPPORTED_STANZA_TYPE,
                sessionContext.getXMLLang(),
                "service unavailable at this session state",
                null);
        Stanza streamOpener = new ServerResponses().getStreamOpenerForError(false, sessionContext.getServerJID(), XMPPVersion.VERSION_1_0, errorStanza);

        writeErrorAndClose(sessionContext, streamOpener);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

     * writes a response in this context from the given emmitter
     * @param sessionContext
     * @param responseStanzaContainer
     */
    public static void writeResponse(SessionContext sessionContext, ResponseStanzaContainer responseStanzaContainer) {
        Stanza responseStanza = responseStanzaContainer.getResponseStanza();
        writeResponse(sessionContext, responseStanza);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

    public static void writeResponse(SessionContext sessionContext, Stanza responseStanza) {
        sessionContext.getResponseWriter().write(responseStanza);
    }

    public static void handleProtocolError(ProtocolException protocolException, SessionContext sessionContext, Stanza receivedStanza) {
        Stanza errorStanza = null;
        if (protocolException != null) errorStanza = protocolException.getErrorStanza();

        if (errorStanza == null) {
            errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.BAD_FORMAT,
                                                              sessionContext.getXMLLang(),
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

        }
        writeErrorAndClose(sessionContext, errorStanza);
    }

    public void handleUnsupportedStanzaType(SessionContext sessionContext, Stanza receivedStanza) {
        Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.UNSUPPORTED_STANZA_TYPE,
                                                          sessionContext.getXMLLang(),
                                                          "could not process incoming stanza",
                                                          receivedStanza);
        writeErrorAndClose(sessionContext, errorStanza);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

                                                          receivedStanza);
        writeErrorAndClose(sessionContext, errorStanza);
    }

    public void handleNotAuthorized(SessionContext sessionContext, Stanza receivedStanza) {
        Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.NOT_AUTHORIZED,
                                                          sessionContext.getXMLLang(),
                                                          "could not process incoming stanza",
                                                          receivedStanza);
        writeErrorAndClose(sessionContext, errorStanza);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

        if (receivedCoreStanza == null) {
            handleNotAuthorized(sessionContext, receivedStanza);
            return;
        }

        Stanza errorStanza = ServerErrorResponses.getInstance().getStanzaError(StanzaErrorCondition.UNKNOWN_SENDER,
                                                          receivedCoreStanza,
                                                          StanzaErrorType.MODIFY,
                                                          "from attribute does not match authorized entity",
                                                          null, null);
        writeResponse(sessionContext, errorStanza);
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

    }

    public void handleParsingException(SessionContext sessionContext, ParsingException e) {
        //TODO write the __right__ error response, not bad-format default only
        if (e.getErrorCondition() != ParsingErrorCondition.BAD_FORMAT) throw new RuntimeException("cannot handle this error condition yet");
        Stanza errorStanza = ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.BAD_FORMAT,
                sessionContext.getXMLLang(),
                "could not parse incoming stanza",
                null);
        writeErrorAndClose(sessionContext, errorStanza);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

            stanza = XMPPCoreStanza.getWrapper(stanza);
        }
        if (stanza == null) throw new IllegalArgumentException("cannot coerce into a message, iq or presence stanza");

        XMPPCoreStanza coreStanza = (XMPPCoreStanza) stanza;
        Stanza errorStanza = ServerErrorResponses.getInstance().getStanzaError(StanzaErrorCondition.SERVICE_UNAVAILABLE, coreStanza, StanzaErrorType.CANCEL, "namespace not supported", null, null);
        return new ResponseStanzaContainerImpl(errorStanza);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

    }

   
    public void testIdentityAndFeature() {
        DefaultDiscoInfoStanzaGenerator sg = (DefaultDiscoInfoStanzaGenerator)getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService.getBareJID(), "id123");

        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
View Full Code Here

Examples of org.apache.vysper.xmpp.stanza.Stanza

   
    public void testInfoRequestForANode() throws Exception {
        root.add(new LeafNode(serviceConfiguration, "news", "News", client));

        DefaultDiscoInfoStanzaGenerator sg = (DefaultDiscoInfoStanzaGenerator)getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService.getBareJID(), "id123","news");

        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.