本文整理匯總了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));
}