• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MXParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jivesoftware.openfire.net.MXParser的典型用法代码示例。如果您正苦于以下问题:Java MXParser类的具体用法?Java MXParser怎么用?Java MXParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MXParser类属于org.jivesoftware.openfire.net包,在下文中一共展示了MXParser类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getXPPFactory

import org.jivesoftware.openfire.net.MXParser; //导入依赖的package包/类
public XmlPullParserFactory getXPPFactory() throws XmlPullParserException {
    if (xppFactory == null) {
        xppFactory = XmlPullParserFactory.newInstance(MXParser.class.getName(), null);
    }
    xppFactory.setNamespaceAware(true);
    return xppFactory;
}
 
开发者ID:lijian17,项目名称:androidpn-server,代码行数:8,代码来源:XMPPPacketReader.java


示例2: process

import org.jivesoftware.openfire.net.MXParser; //导入依赖的package包/类
public void process(String stanza, XMPPPacketReader reader)
        throws Exception {

    boolean initialStream = stanza.startsWith("<stream:stream");
    if (!sessionCreated || initialStream) {
        if (!initialStream) {
            // Ignore <?xml version="1.0"?>
            return;
        }
        // Found an stream:stream tag...
        if (!sessionCreated) {
            sessionCreated = true;
            MXParser parser = reader.getXPPParser();
            parser.setInput(new StringReader(stanza));
            createSession(parser);
        }
        return;
    }

    // Verify if end of stream was requested
    if (stanza.equals("</stream:stream>")) {
        session.close();
        return;
    }
    // Ignore <?xml version="1.0"?> stanzas sent by clients
    if (stanza.startsWith("<?xml")) {
        return;
    }
    // Create DOM object from received stanza
    Element doc = reader.read(new StringReader(stanza)).getRootElement();
    if (doc == null) {
        return;
    }
    process(doc);
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:36,代码来源:StanzaHandler.java


示例3: process

import org.jivesoftware.openfire.net.MXParser; //导入依赖的package包/类
public void process(String stanza, XMPPPacketReader reader)
        throws Exception {
    boolean initialStream = stanza.startsWith("<stream:stream");
    if (!sessionCreated || initialStream) {
        if (!initialStream) {
            return; // Ignore <?xml version="1.0"?>
        }
        if (!sessionCreated) {
            sessionCreated = true;
            MXParser parser = reader.getXPPParser();
            parser.setInput(new StringReader(stanza));
            createSession(parser);
        }
        return;
    }

    // If end of stream was requested
    if (stanza.equals("</stream:stream>")) {
        session.close();
        return;
    }
    // Ignore <?xml version="1.0"?>
    if (stanza.startsWith("<?xml")) {
        return;
    }
    // Create DOM object
    Element doc = reader.read(new StringReader(stanza)).getRootElement();
    if (doc == null) {
        return;
    }
    processDoc(doc);
}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:33,代码来源:StanzaHandler.java


示例4: attemptSASLexternal

import org.jivesoftware.openfire.net.MXParser; //导入依赖的package包/类
private static LocalOutgoingServerSession attemptSASLexternal(SocketConnection connection, MXParser xpp, XMPPPacketReader reader, String domain, String hostname, String id, StringBuilder openingStream) throws DocumentException, IOException, XmlPullParserException {
	final Logger log = LoggerFactory.getLogger(LocalOutgoingServerSession.class.getName()+"['"+hostname+"']");
    log.debug("Starting EXTERNAL SASL.");
    if (doExternalAuthentication(domain, connection, reader)) {
        log.debug("EXTERNAL SASL was successful.");
        // SASL was successful so initiate a new stream
        connection.deliverRawText(openingStream.toString());

        // Reset the parser
        xpp.resetInput();
        // Skip the opening stream sent by the server
        for (int eventType = xpp.getEventType(); eventType != XmlPullParser.START_TAG;) {
            eventType = xpp.next();
        }

        // SASL authentication was successful so create new OutgoingServerSession
        id = xpp.getAttributeValue("", "id");
        StreamID streamID = new BasicStreamIDFactory().createStreamID(id);
        LocalOutgoingServerSession session = new LocalOutgoingServerSession(domain,
                connection, new OutgoingServerSocketReader(reader), streamID);
        connection.init(session);
        // Set the hostname as the address of the session
        session.setAddress(new JID(null, hostname, null));
        // Set that the session was created using TLS+SASL (no server dialback)
        session.usingServerDialback = false;
        return session;
    }
    else {
        log.debug("EXTERNAL SASL failed.");
        return null;
    }  	
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:33,代码来源:LocalOutgoingServerSession.java


示例5: process

import org.jivesoftware.openfire.net.MXParser; //导入依赖的package包/类
/**
* 使用给定的XMPP包阅读器接收节过程
* 
* @param stanza
*            收到的statza
* @param reader
*            XMPP包阅读器
* @throws Exception
*             如果XML流无效。
*/
  public void process(String stanza, XMPPPacketReader reader)
          throws Exception {
      boolean initialStream = stanza.startsWith("<stream:stream");
      if (!sessionCreated || initialStream) {
          if (!initialStream) {
              return; // Ignore <?xml version="1.0"?>
          }
          if (!sessionCreated) {
              sessionCreated = true;
              MXParser parser = reader.getXPPParser();
              parser.setInput(new StringReader(stanza));
              createSession(parser);
          } else if (startedTLS) {
              startedTLS = false;
              tlsNegotiated();
          }
          return;
      }

// 如果请求结束流
      if (stanza.equals("</stream:stream>")) {
          session.close();
          return;
      }
// 忽略 <?xml version="1.0"?>
      if (stanza.startsWith("<?xml")) {
          return;
      }
// 创建DOM对象
      Element doc = reader.read(new StringReader(stanza)).getRootElement();
      if (doc == null) {
          return;
      }

      String tag = doc.getName();
      if ("starttls".equals(tag)) {
          if (negotiateTLS()) { // Negotiate TLS
              startedTLS = true;
          } else {
              connection.close();
              session = null;
          }
      } else if ("message".equals(tag)) {
          processMessage(doc);
      } else if ("presence".equals(tag)) {
          log.debug("presence...");
          processPresence(doc);
      } else if ("iq".equals(tag)) {
          log.debug("iq...");
          processIQ(doc);
      } else {
	log.warn("意外的数据包tag (not message, iq, presence)" + doc.asXML());
          session.close();
      }

  }
 
开发者ID:lijian17,项目名称:androidpn-server,代码行数:67,代码来源:StanzaHandler.java


示例6: process

import org.jivesoftware.openfire.net.MXParser; //导入依赖的package包/类
/**
 * Process the received stanza using the given XMPP packet reader.
 *  
 * @param stanza the received statza
 * @param reader the XMPP packet reader
 * @throws Exception if the XML stream is not valid.
 */
public void process(String stanza, XMPPPacketReader reader)
        throws Exception {
    boolean initialStream = stanza.startsWith("<stream:stream");
    if (!sessionCreated || initialStream) {
        if (!initialStream) {
            return; // Ignore <?xml version="1.0"?>
        }
        if (!sessionCreated) {
            sessionCreated = true;
            MXParser parser = reader.getXPPParser();
            parser.setInput(new StringReader(stanza));
            createSession(parser);
        } else if (startedTLS) {
            startedTLS = false;
            tlsNegotiated();
        }
        return;
    }

    // If end of stream was requested
    if (stanza.equals("</stream:stream>")) {
        session.close();
        return;
    }
    // Ignore <?xml version="1.0"?>
    if (stanza.startsWith("<?xml")) {
        return;
    }
    // Create DOM object
    Element doc = reader.read(new StringReader(stanza)).getRootElement();
    if (doc == null) {
        return;
    }

    String tag = doc.getName();
    if ("starttls".equals(tag)) {
        if (negotiateTLS()) { // Negotiate TLS
            startedTLS = true;
        } else {
            connection.close();
            session = null;
        }
    } else if ("message".equals(tag)) {
        processMessage(doc);
    } else if ("presence".equals(tag)) {
        log.debug("presence...");
        processPresence(doc);
    } else if ("iq".equals(tag)) {
        log.debug("iq...");
        processIQ(doc);
    } else {
        log.warn("Unexpected packet tag (not message, iq, presence)"
                + doc.asXML());
        session.close();
    }

}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:65,代码来源:StanzaHandler.java


示例7: process

import org.jivesoftware.openfire.net.MXParser; //导入依赖的package包/类
/**
 * Process the received stanza using the given XMPP packet reader.
 *  
 * @param stanza the received statza
 * @param reader the XMPP packet reader
 * @throws Exception if the XML stream is not valid.
 */
public void process(String stanza, XMPPPacketReader reader)
        throws Exception {
    boolean initialStream = stanza.startsWith("<stream:stream");
    if (!sessionCreated || initialStream) {
        if (!initialStream) {
            return; // Ignore <?xml version="1.0"?>
        }
        if (!sessionCreated) {
            sessionCreated = true;
            MXParser parser = reader.getXPPParser();
            parser.setInput(new StringReader(stanza));
            createSession(parser);
        }
        return;
    }

    // If end of stream was requested
    if (stanza.equals("</stream:stream>")) {
        session.close();
        return;
    }
    // Ignore <?xml version="1.0"?>
    if (stanza.startsWith("<?xml")) {
        return;
    }
    // Create DOM object
    Element doc = reader.read(new StringReader(stanza)).getRootElement();
    if (doc == null) {
        return;
    }

    String tag = doc.getName();
    if ("message".equals(tag)) {
        processMessage(doc);
    } else if ("presence".equals(tag)) {
        log.debug("presence...");
        processPresence(doc);
    } else if ("iq".equals(tag)) {
        log.debug("iq...");
        processIQ(doc);
    } else {
        log.warn("Unexpected packet tag (not message, iq, presence)"
                + doc.asXML());
        session.close();
    }

}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:55,代码来源:StanzaHandler.java


示例8: process

import org.jivesoftware.openfire.net.MXParser; //导入依赖的package包/类
public void process(String stanza, XMPPPacketReader reader)
        throws Exception {
    boolean initialStream = stanza.startsWith("<stream:stream");
    if (!sessionCreated || initialStream) {
        if (!initialStream) {
            return; // Ignore <?xml version="1.0"?>
        }
        if (!sessionCreated) {
            sessionCreated = true;
            MXParser parser = reader.getXPPParser();
            parser.setInput(new StringReader(stanza));
            createSession(parser);
        }
        return;
    }

    // If end of stream was requested
    if (stanza.equals("</stream:stream>")) {
        session.close();
        return;
    }
    // Ignore <?xml version="1.0"?>
    if (stanza.startsWith("<?xml")) {
        return;
    }
    // Create DOM object
    Element doc = reader.read(new StringReader(stanza)).getRootElement();
    if (doc == null) {
        return;
    }

    String tag = doc.getName();
    if ("message".equals(tag)) {
        processMessage(doc);
    } else if ("presence".equals(tag)) {
        log.debug("presence...");
        processPresence(doc);
    } else if ("iq".equals(tag)) {
        log.debug("iq...");
        processIQ(doc);
    } else {
        log.warn("Unexpected packet tag (not message, iq, presence)"
                + doc.asXML());
        session.close();
    }

}
 
开发者ID:elphinkuo,项目名称:Androidpn,代码行数:48,代码来源:StanzaHandler.java



注:本文中的org.jivesoftware.openfire.net.MXParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XDocReportException类代码示例发布时间:2022-05-23
下一篇:
Java TestMEMM类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap