本文整理汇总了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;未经允许,请勿转载。 |
请发表评论