本文整理匯總了Java中org.jivesoftware.smack.packet.IQ.setError方法的典型用法代碼示例。如果您正苦於以下問題:Java IQ.setError方法的具體用法?Java IQ.setError怎麽用?Java IQ.setError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jivesoftware.smack.packet.IQ
的用法示例。
在下文中一共展示了IQ.setError方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createJingleError
import org.jivesoftware.smack.packet.IQ; //導入方法依賴的package包/類
/**
* Complete and send an error. Complete all the null fields in an IQ error
* reponse, using the sesssion information we have or some info from the
* incoming packet.
*
* @param iq
* The Jingle stanza(/packet) we are responing to
* @param jingleError
* the IQ stanza(/packet) we want to complete and send
*/
public IQ createJingleError(IQ iq, JingleError jingleError) {
IQ errorPacket = null;
if (jingleError != null) {
// TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways
XMPPError error = new XMPPError(XMPPError.Condition.undefined_condition, jingleError);
errorPacket = IQ.createErrorResponse(iq, error);
// Fill in the fields with the info from the Jingle packet
errorPacket.setStanzaId(iq.getStanzaId());
errorPacket.setError(error);
// errorPacket.addExtension(jingleError);
// NO! Let the normal state machinery do all of the sending.
// getConnection().sendStanza(perror);
LOGGER.severe("Error sent: " + errorPacket.toXML());
}
return errorPacket;
}