当前位置: 首页>>代码示例>>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;未经允许,请勿转载。