當前位置: 首頁>>代碼示例>>Java>>正文


Java PacketErrorTypeException類代碼示例

本文整理匯總了Java中tigase.xmpp.PacketErrorTypeException的典型用法代碼示例。如果您正苦於以下問題:Java PacketErrorTypeException類的具體用法?Java PacketErrorTypeException怎麽用?Java PacketErrorTypeException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PacketErrorTypeException類屬於tigase.xmpp包,在下文中一共展示了PacketErrorTypeException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public boolean execute(Packet packet, Element rule) {
	try {
		Packet result = prepareAmpPacket(packet, rule);
		Element error = ERROR_TEMPLATE.clone();
		Element failed_rules = FAILED_RULES.clone();

		failed_rules.addChild(rule);
		error.addChild(failed_rules);
		result.getElement().addChild(error);
		resultsHandler.addOutPacket(result);
	} catch (PacketErrorTypeException ex) {

		// Ignore
	}

	return false;
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:19,代碼來源:Error.java

示例2: bouncePacketsBack

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
private void bouncePacketsBack(Authorization author, CID cid) {
	ServerConnections serv_conns = getServerConnections(cid);

	if (serv_conns != null) {
		Queue<Packet> waiting = serv_conns.getWaitingPackets();
		Packet p = null;

		while ((p = waiting.poll()) != null) {
			if (log.isLoggable(Level.FINEST)) {
				log.finest("Sending packet back: " + p);
			}

			try {
				addOutPacket(author.getResponseMessage(p, "S2S - not delivered", true));
			} catch (PacketErrorTypeException e) {
				log.info("Packet processing exception: " + e);
			}
		}    // end of while (p = waitingPackets.remove(ipAddress) != null)
	} else {
		log.info("No ServerConnections for cid: " + cid);
	}
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:23,代碼來源:ServerConnectionManager.java

示例3: processNullSessionPacket

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public void processNullSessionPacket(Packet packet, NonAuthUserRepository repo,
		Queue<Packet> results, Map<String, Object> settings)
				throws PacketErrorTypeException {
	if (packet.getType() == StanzaType.get) {
		try {
			String strvCard = repo.getPublicData(packet.getStanzaTo().getBareJID(), ID,
					VCARD_KEY, null);

			if (strvCard != null) {
				results.offer(parseXMLData(strvCard, packet));
			} else {
				results.offer(packet.okResult((String) null, 1));
			}    // end of if (vcard != null)
		} catch (UserNotFoundException e) {
			results.offer(Authorization.ITEM_NOT_FOUND.getResponseMessage(packet,
					"User not found", true));
		}    // end of try-catch
	} else {

		// This is most likely a response to the user from the remote
		// entity with vCard request results.
		// Processed in processToUserPacket() method.
	}
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:26,代碼來源:VCardTemp.java

示例4: processNullSessionPacket

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
/**
 * Method description
 *
 *
 * @param packet
 * @param repo
 * @param results
 * @param settings
 *
 * @throws PacketErrorTypeException
 */
@Override
public void processNullSessionPacket(Packet packet, NonAuthUserRepository repo,
		Queue<Packet> results, Map<String, Object> settings)
				throws PacketErrorTypeException {
	if (packet.getType() == StanzaType.get) {
		try {
			String strvCard = repo.getPublicData(packet.getStanzaTo().getBareJID(), ID,
					VCARD_KEY, null);

			if (strvCard != null) {
				results.offer(parseXMLData(strvCard, packet));
			} else {
				results.offer(packet.okResult((String) null, 1));
			}    // end of if (vcard != null)
		} catch (UserNotFoundException e) {
			results.offer(Authorization.ITEM_NOT_FOUND.getResponseMessage(packet,
					"User not found", true));
		}    // end of try-catch
	} else {

		// This is most likely a response to the user from the remote
		// entity with vCard request results.
		// Processed in processToUserPacket() method.
	}
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:37,代碼來源:VCard4.java

示例5: processFromUserPacket

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public void processFromUserPacket( JID connectionId, Packet packet, XMPPResourceConnection session,
																	 NonAuthUserRepository repo, Queue<Packet> results,
																	 Map<String, Object> settings )
		throws PacketErrorTypeException {
		// Check whether the packet is addressed to the server or some other, XMPP entity
		if ((packet.getStanzaTo() == null)
				|| session.isLocalDomain(packet.getStanzaTo().toString(), false)) {
			if (log.isLoggable(Level.FINEST)) {
				log.log(Level.FINEST, "Calling method: {0}, for packet={1}, for session={2}",
						new Object[] { "processFromUserToServerPacket",
						packet, session });
			}
			processFromUserToServerPacket(connectionId, packet, session, repo, results,
					settings);
		} else {
			if (log.isLoggable(Level.FINEST)) {
				log.log(Level.FINEST, "Calling method: {0}, for packet={1}, for session={2}",
						new Object[] { "processFromUserOutPacket",
						packet, session });
			}
			processFromUserOutPacket(connectionId, packet, session, repo, results, settings);
		}
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:25,代碼來源:JabberIqVersion.java

示例6: processOfflineUser

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
private void processOfflineUser( Packet packet, Queue<Packet> results ) throws PacketErrorTypeException {

		if (packet.getStanzaTo() != null && packet.getStanzaTo().getResource() != null) {
			if (deliveryRules != MessageDeliveryRules.strict) {
				StanzaType type = packet.getType();
				if (type == null) {
					type = StanzaType.normal;
				}
				switch (type) {
					case chat:
						// try to deliver this message to all available resources so we should
						// treat it as a stanza with bare "to" attribute
						Packet result = packet.copyElementOnly();
						result.initVars(packet.getStanzaFrom(),
															packet.getStanzaTo().copyWithoutResource());
						results.offer(result);
						break;

					case error:
						// for error packet we should ignore stanza according to RFC 6121
						break;

					case headline:
					case groupchat:
					case normal:
					default:
						// for each of this types RFC 6121 recomends silent ignoring of stanza
						// or to return error recipient-unavailable - we will send error as
						// droping packet without response may not be a good idea
						results.offer(Authorization.RECIPIENT_UNAVAILABLE.getResponseMessage(
								packet, "The recipient is no longer available.", true));
				}
			}
			else {
				results.offer(Authorization.RECIPIENT_UNAVAILABLE.getResponseMessage(packet,
																																							 "The recipient is no longer available.", true));
			}
		}
	}
 
開發者ID:QuickBlox,項目名稱:QuickBlox-Tigase-CustomFeatures,代碼行數:40,代碼來源:Message.java

示例7: processPacket

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public void processPacket(final Packet packet, final Queue<Packet> results) {
	++packets_received;
	if (log.isLoggable(Level.FINEST)) {
		log.finest(getJID() + ": " + "Processing packet: " + packet.toString());
	}
	if (packet.getType() == StanzaType.error) {
		log.fine("Ignoring error stanza: " + packet.toString());

		return;
	}
	if (packet.getElemName().equals("presence")) {
		processPresence(packet, results);
	}    // end of if (packet.getElemName().equals("presence))
	if (packet.getElemName().equals("message")) {
		if (isAllowedToPost(packet.getStanzaFrom())) {
			processMessage(packet, results);
		} else {
			try {
				results.offer(Authorization.NOT_ALLOWED.getResponseMessage(packet,
								"You are not allowed to post a message.", true));
			} catch (PacketErrorTypeException e) {
				log.warning("Packet processing exception: " + e);
			}
		}
	}    // end of if (packet.getElemName().equals("message"))
	packets_sent += results.size();
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:29,代碼來源:AbstractReceiverTask.java

示例8: execute

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public boolean execute(Packet packet, Element rule) {
	try {
		if (packet.getStanzaFrom() != null && packet.getStanzaFrom().getBareJID().getLocalpart() != null ) {
			Packet result = prepareAmpPacket(packet, rule);
			resultsHandler.addOutPacket(result);
		}

	} catch (PacketErrorTypeException ex) {

		// Ignore
	}

	return true;
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:16,代碼來源:Notify.java

示例9: execute

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public boolean execute(Packet packet, Element rule) {
	try {
		Packet result = prepareAmpPacket(packet, rule);

		resultsHandler.addOutPacket(result);
	} catch (PacketErrorTypeException ex) {

		// Ignore....
	}

	return false;
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:14,代碼來源:Alert.java

示例10: processPacket

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public void processPacket(Packet packet) {
	if (log.isLoggable(Level.FINER)) {
		log.finer("Processing packet: " + packet.getElemName() + ", type: " + packet.getType());
	}

	if (log.isLoggable(Level.FINEST)) {
		log.finest("Processing packet: " + packet);
	}

	if ((packet.getStanzaTo() != null) && packet.getStanzaTo().equals(getComponentId())) {
		try {
			addOutPacket(Authorization.FEATURE_NOT_IMPLEMENTED.getResponseMessage(packet,
					"Not implemented", true));
		} catch (PacketErrorTypeException e) {
			log.warning("Packet processing exception: " + e);
		}

		return;
	}

	if (pack_routed && packet.getElemName() != "route") {
		writePacketToSocket(packet.packRouted());
	} else {
		writePacketToSocket(packet);
	}
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:28,代碼來源:ComponentConnectionManager.java

示例11: sendErrorAndStop

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
/**
 * Method description
 *
 *
 * @param errorCode
 * @param packet
 * @param errorMsg
 *
 * @throws IOException
 */
public void sendErrorAndStop(Authorization errorCode, StreamError streamError, Packet packet, String errorMsg)
				throws IOException {
	for (XMPPIOProcessor proc  : processors) {
		proc.streamError(this, streamError);
	}
	String code = "<body type='terminate'" + " condition='" + (streamError != null ? streamError.getCondition() : errorCode.getCondition()) + "'" +
			" xmlns='http://jabber.org/protocol/httpbind'/>";

	try {
		Packet error = errorCode.getResponseMessage(packet, errorMsg, false);

		code = error.getElement().toString();
	} catch (PacketErrorTypeException e) {

		// ignore
	}

	StringBuilder sb = new StringBuilder(200);

	sb.append("HTTP/1.1 ").append(errorCode.getErrorCode()).append(" ");
	sb.append(errorMsg).append(EOL);
	sb.append(CONTENT_TYPE_HEADER).append(content_type).append(EOL);
	sb.append(CONTENT_TYPE_LENGTH).append(code.getBytes().length).append(EOL);
	if (extra_headers != null) {
		sb.append(extra_headers);
	}

	// sb.append("X-error-code").append(code).append(EOL);
	sb.append(CONNECTION + "close" + EOL);
	sb.append(SERVER).append(EOL);
	sb.append(EOL);
	sb.append(code);
	if (log.isLoggable(Level.FINEST)) {
		log.log(Level.FINEST, "Writing to socket:\n{0}", sb.toString());
	}
	super.writeRawData(sb.toString());
	stop();
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:49,代碼來源:BoshIOService.java

示例12: sendPacketsBack

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
private void sendPacketsBack() {
	Packet p = null;

	while ((p = waitingPackets.poll()) != null) {
		try {
			handler.addOutPacket(Authorization.REMOTE_SERVER_NOT_FOUND.getResponseMessage(p,
							"S2S - destination host not found", true));
		} catch (PacketErrorTypeException e) {
			log.log(Level.WARNING, "Packet: {0} processing exception: {1}",
							new Object[] { p.toString(),
														 e });
		}
	}
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:15,代碼來源:CIDConnections.java

示例13: processToUserPacket

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public void processToUserPacket(Packet packet, XMPPResourceConnection session,
																NonAuthUserRepository repo, Queue<Packet> results,
																Map<String, Object> settings)
				throws PacketErrorTypeException {
	if (packet.getElemName() == "iq") {
		processIq(packet, session, repo, results, settings);
	} else {
		super.processToUserPacket(packet, session, repo, results, settings);
	}
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:12,代碼來源:RemoteRosterManagement.java

示例14: processFromUserToServerPacket

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public void processFromUserToServerPacket(JID connectionId, Packet packet, XMPPResourceConnection session,
		NonAuthUserRepository repo, Queue<Packet> results, Map<String, Object> settings) throws PacketErrorTypeException {
	if (packet.getStanzaTo() != null && packet.getStanzaFrom() != null
			&& packet.getStanzaTo().equals(packet.getStanzaFrom())) {
		processFromUserOutPacket(connectionId, packet, session, repo, results, settings);
	} else if (packet.getType() == StanzaType.get) {
		sendTimeResult(packet, results);
	} else
		results.offer(Authorization.BAD_REQUEST.getResponseMessage(packet, "Message type is incorrect", true));
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:12,代碼來源:EntityTime.java

示例15: processNullSessionPacket

import tigase.xmpp.PacketErrorTypeException; //導入依賴的package包/類
@Override
public void processNullSessionPacket(Packet packet, NonAuthUserRepository repo, Queue<Packet> results,
		Map<String, Object> settings) throws PacketErrorTypeException {
	if (packet.getType() == StanzaType.get) {
		sendTimeResult(packet, results);
	} else if (packet.getType() == StanzaType.set)
		results.offer(Authorization.BAD_REQUEST.getResponseMessage(packet, "Message type is incorrect", true));
	else
		super.processNullSessionPacket(packet, repo, results, settings);
}
 
開發者ID:kontalk,項目名稱:tigase-server,代碼行數:11,代碼來源:EntityTime.java


注:本文中的tigase.xmpp.PacketErrorTypeException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。