本文整理汇总了Java中org.jivesoftware.openfire.nio.XMLLightweightParser类的典型用法代码示例。如果您正苦于以下问题:Java XMLLightweightParser类的具体用法?Java XMLLightweightParser怎么用?Java XMLLightweightParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLLightweightParser类属于org.jivesoftware.openfire.nio包,在下文中一共展示了XMLLightweightParser类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doDecode
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
@Override
public boolean doDecode(IoSession session, IoBuffer in,
ProtocolDecoderOutput out) throws Exception {
// log.debug("doDecode(...)...");
XMLLightweightParser parser = (XMLLightweightParser) session
.getAttribute(XmppIoHandler.XML_PARSER);
parser.read(in);
// 如果有消息
if (parser.areThereMsgs()) {
for (String stanza : parser.getMsgs()) {
out.write(stanza);
}
}
// 是否还有剩余
return !in.hasRemaining();
}
示例2: doDecode
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
@Override
public boolean doDecode(IoSession session, IoBuffer in,
ProtocolDecoderOutput out) throws Exception {
// log.debug("doDecode(...)...");
XMLLightweightParser parser = (XMLLightweightParser) session
.getAttribute(XmppIoHandler.XML_PARSER);
parser.read(in);
if (parser.areThereMsgs()) {
for (String stanza : parser.getMsgs()) {
out.write(stanza);
}
}
return !in.hasRemaining();
}
示例3: doDecode
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
@Override
public boolean doDecode(IoSession session, IoBuffer in,
ProtocolDecoderOutput out) throws Exception {
log.debug("doDecode(...)...");
// Get the XML light parser from the IoSession
XMLLightweightParser parser = (XMLLightweightParser) session
.getAttribute("XML-PARSER");
// Parse as many stanzas as possible from the received data
parser.read(in);
if (parser.areThereMsgs()) {
for (String stanza : parser.getMsgs()) {
out.write(stanza);
}
}
return !in.hasRemaining();
}
示例4: doDecode
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
@Override
public boolean doDecode(IoSession session, IoBuffer in,
ProtocolDecoderOutput out) throws Exception {
log.debug("doDecode(...)...");
XMLLightweightParser parser = (XMLLightweightParser) session
.getAttribute("XML_PARSER");
parser.read(in);
if (parser.areThereMsgs()) {
for (String stanza : parser.getMsgs()) {
out.write(stanza);
}
}
return !in.hasRemaining();
}
示例5: sessionOpened
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
/**
* 当一个连接被打开时,将被调用
*/
public void sessionOpened(IoSession session) throws Exception {
log.debug("sessionOpened()...");
log.debug("remoteAddress=" + session.getRemoteAddress());
// 创建一个新的XML解析器
XMLLightweightParser parser = new XMLLightweightParser("UTF-8");
session.setAttribute(XML_PARSER, parser);
// 创建一个新的连接
Connection connection = new Connection(session);
session.setAttribute(CONNECTION, connection);
session.setAttribute(STANZA_HANDLER, new StanzaHandler(serverName,
connection));
}
示例6: sessionOpened
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
/**
* Invoked when a connection has been opened.
*/
public void sessionOpened(IoSession session) throws Exception {
log.debug("sessionOpened()...");
log.debug("remoteAddress=" + session.getRemoteAddress());
// Create a new XML parser
XMLLightweightParser parser = new XMLLightweightParser("UTF-8");
session.setAttribute(XML_PARSER, parser);
// Create a new connection
Connection connection = new Connection(session);
session.setAttribute(CONNECTION, connection);
session.setAttribute(STANZA_HANDLER, new StanzaHandler(serverName,
connection));
}
示例7: sessionOpened
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
public void sessionOpened(IoSession session) throws Exception {
log.debug("sessionOpened()...");
log.debug("remoteAddress=" + session.getRemoteAddress());
// Create a new XML parser for the new connection
XMLLightweightParser parser = new XMLLightweightParser(CHARSET);
session.setAttribute(XML_PARSER, parser);
// Create a new Connection for the new session
Connection connection = new Connection(session);
session.setAttribute(CONNECTION, connection);
session.setAttribute(STANZA_HANDLER, new ClientStanzaHandler(
serverName, connection));
}
示例8: sessionOpened
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
public void sessionOpened(IoSession session) throws Exception {
log.debug("sessionOpened()...");
log.debug("remoteAddress=" + session.getRemoteAddress());
// Create a new XML parser
XMLLightweightParser parser = new XMLLightweightParser(CHARSET);
session.setAttribute(XML_PARSER, parser);
// Create a new connection
Connection connection = new Connection(session);
session.setAttribute(CONNECTION, connection);
session.setAttribute(STANZA_HANDLER, new StanzaHandler(
serverName, connection));
}
示例9: sessionOpened
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
public void sessionOpened(IoSession session) throws Exception {
log.debug("sessionOpened()...");
log.debug("remoteAddress=" + session.getRemoteAddress());
// Create a new XML parser
XMLLightweightParser parser = new XMLLightweightParser(CHARSET);
session.setAttribute(XML_PARSER, parser);
// Create a new connection
Connection connection = new Connection(session);
session.setAttribute(CONNECTION, connection);
session.setAttribute(STANZA_HANDLER, new ClientStanzaHandler(
serverName, connection));
}
示例10: sessionOpened
import org.jivesoftware.openfire.nio.XMLLightweightParser; //导入依赖的package包/类
public void sessionOpened(IoSession session) throws Exception {
log.debug("sessionOpened()...");
// Create a new XML parser for the new connection. The parser will be
// used by the XMPPDecoder filter.
XMLLightweightParser parser = new XMLLightweightParser(CHARSET);
session.setAttribute(XML_PARSER, parser);
// // Create a new Connection for the new session
// Connection connection = new Connection(session);
// session.setAttribute(CONNECTION, connection);
// session.setAttribute(STANZA_HANDLER, new ClientStanzaHandler(
// serverName, connection));
}