Package org.jivesoftware.smack.packet

Examples of org.jivesoftware.smack.packet.Message.toXML()


        assertEquals(defaultLanguage, message.getBody());
        assertEquals(otherLanguage, message.getBody(otherLanguage));
        assertEquals(2, message.getBodies().size());
        assertEquals(1, message.getBodyLanguages().size());
        assertTrue(message.getBodyLanguages().contains(otherLanguage));
        assertXMLEqual(control, message.toXML());

        // message has default language, first body no language, second body default language
        control = XMLBuilder.create("message")
            .a("from", "romeo@montague.lit/orchard")
            .a("to", "juliet@capulet.lit/balcony")
View Full Code Here


        assertEquals(defaultLanguage, message.getBody());
        assertEquals(defaultLanguage, message.getBody(defaultLanguage));
        assertEquals(1, message.getBodies().size());
        assertEquals(0, message.getBodyLanguages().size());
        assertXMLNotEqual(control, message.toXML());

        // message has non-default language, first body no language, second body default language
        control = XMLBuilder.create("message")
            .a("from", "romeo@montague.lit/orchard")
            .a("to", "juliet@capulet.lit/balcony")
View Full Code Here

        assertEquals(otherLanguage, message.getBody());
        assertEquals(defaultLanguage, message.getBody(defaultLanguage));
        assertEquals(2, message.getBodies().size());
        assertEquals(1, message.getBodyLanguages().size());
        assertTrue(message.getBodyLanguages().contains(defaultLanguage));
        assertXMLEqual(control, message.toXML());

        // message has no language, first body no language, second body default language
        control = XMLBuilder.create("message")
            .a("from", "romeo@montague.lit/orchard")
            .a("to", "juliet@capulet.lit/balcony")
View Full Code Here

   * This method will be triggered, when a message is arrived at client side
   */
  public void processPacket(Packet packet) {   
    Message message = (Message)packet;
    String xml = StringEscapeUtils.unescapeXml(message.getBody());
    log.debug("Client received message : "+message.toXML());
    InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
   
    String sequenceNumber = (String)message.getProperty(XMPPConstants.SEQUENCE_ID);
    if(sequenceNumber != null){
        WaitingDetails waitingDetails = prespectiveResponseMap.remove(sequenceNumber);
View Full Code Here

        xmppClientSidePacketListener.listenForResponse(key, msgCtx);
        message.setProperty(XMPPConstants.SEQUENCE_ID, key);
      }     

      chat.sendMessage(message);
      log.debug("Sent message :"+message.toXML());

      //If this is on client side, wait for the response from server.
      //Is this the best way to do this?
      if(waitForResponse && !msgCtx.isServerSide()){
          xmppClientSidePacketListener.waitFor(key);
View Full Code Here

          log.debug("Received response sucessfully");
      }
     

    } catch (XMPPException e) {
      log.error("Error occurred while sending the message : "+message.toXML(),e);
      handleException("Error occurred while sending the message : "+message.toXML(),e);
    } catch (InterruptedException e) {
        log.error("Error occurred while sending the message : "+message.toXML(),e);
            handleException("Error occurred while sending the message : "+message.toXML(),e);
        }finally{
View Full Code Here

      }
     

    } catch (XMPPException e) {
      log.error("Error occurred while sending the message : "+message.toXML(),e);
      handleException("Error occurred while sending the message : "+message.toXML(),e);
    } catch (InterruptedException e) {
        log.error("Error occurred while sending the message : "+message.toXML(),e);
            handleException("Error occurred while sending the message : "+message.toXML(),e);
        }finally{
//      if(xmppConnection != null && !msgCtx.isServerSide()){
View Full Code Here

    } catch (XMPPException e) {
      log.error("Error occurred while sending the message : "+message.toXML(),e);
      handleException("Error occurred while sending the message : "+message.toXML(),e);
    } catch (InterruptedException e) {
        log.error("Error occurred while sending the message : "+message.toXML(),e);
            handleException("Error occurred while sending the message : "+message.toXML(),e);
        }finally{
//      if(xmppConnection != null && !msgCtx.isServerSide()){
//        xmppConnection.disconnect();
//      }
View Full Code Here

    } catch (XMPPException e) {
      log.error("Error occurred while sending the message : "+message.toXML(),e);
      handleException("Error occurred while sending the message : "+message.toXML(),e);
    } catch (InterruptedException e) {
        log.error("Error occurred while sending the message : "+message.toXML(),e);
            handleException("Error occurred while sending the message : "+message.toXML(),e);
        }finally{
//      if(xmppConnection != null && !msgCtx.isServerSide()){
//        xmppConnection.disconnect();
//      }
    }
View Full Code Here

        try{        
            message.setProperty(XMPPConstants.SEQUENCE_ID,
                    xmppOutTransportInfo.getSequenceID());
           message.setBody(responseMsg);   
          chat.sendMessage(message);
          log.debug("Sent message :"+message.toXML());
        } catch (XMPPException e) {
          XMPPSender.handleException("Error occurred while sending the message : "+message.toXML(),e);
        }
        } 
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.