当前位置: 首页>>代码示例>>Java>>正文


Java PacketRejectedException类代码示例

本文整理汇总了Java中org.jivesoftware.openfire.interceptor.PacketRejectedException的典型用法代码示例。如果您正苦于以下问题:Java PacketRejectedException类的具体用法?Java PacketRejectedException怎么用?Java PacketRejectedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PacketRejectedException类属于org.jivesoftware.openfire.interceptor包,在下文中一共展示了PacketRejectedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: interceptPacket

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
public void interceptPacket(Packet packet, Session session,
		boolean incoming, boolean processed) throws PacketRejectedException {

	if (processed) {
		return;
	}
	if (!incoming) {
		return;
	}

	if (packet instanceof Message) {
		Message msg = (Message) packet;
		process(msg);
	}

}
 
开发者ID:meisterfuu,项目名称:Openfire-GCM,代码行数:17,代码来源:GcmPlugin.java

示例2: interceptPacket

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
/**
 * Keeps a log of the XMPP traffic, releasing the wait lock on response received.
 */
@Override
public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed)
        throws PacketRejectedException {
    if (!processed
            && (ping.getTo().getDomain().equals(packet.getFrom().getDomain()) || ping.getTo().getDomain().equals(packet.getTo().getDomain()))) {

        // Log all traffic to and from the domain.
        xml.append(packet.toXML());
        xml.append('\n');

        // If we've received our IQ response, stop the test.
        if ( packet instanceof IQ )
        {
            final IQ iq = (IQ) packet;
            if ( iq.isResponse() && ping.getID().equals( iq.getID() ) && ping.getTo().equals( iq.getFrom() ) ) {
                Log.info("Successful server to server response received.");
                waitUntil.release();
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:25,代码来源:S2STestService.java

示例3: acceptSubscription

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
private void acceptSubscription(JID toJID, JID fromJID) throws PacketRejectedException {
    if (getSubscriptionLevel().equals(LOCAL)) {
        String toDomain = toJID.getDomain();
        String fromDomain = fromJID.getDomain();

        if (!toDomain.equals(serverName) || !fromDomain.equals(serverName)) {
            return;
        }
    }

    // Simulate that the target user has accepted the presence subscription request
    Presence presence = new Presence();
    presence.setType(Presence.Type.subscribed);

    presence.setTo(fromJID);
    presence.setFrom(toJID);
    router.route(presence);

    throw new PacketRejectedException();
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:SubscriptionPlugin.java

示例4: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
/**
 * At this Point we know: MucBlock = true, !incoming, !processed Package is
 * IQ with Namespace disco#info, from equals the watched subdomain given
 * through subdomain
 */
@Override
public void process(Packet packet, String subdomain, String to, String from) throws PacketRejectedException {
    IQ iqPacket = (IQ) packet;

    if (iqPacket.getType().equals(IQ.Type.result) && to.length() > 0) {
        Element root = iqPacket.getChildElement();

        List<Node> nodes = XpathHelper.findNodesInDocument(root.getDocument(), "//disco:feature");
        for (Node node : nodes) {
            String var = node.valueOf("@var");
            if (var.equals("http://jabber.org/protocol/muc"))
                root.remove(node);
        }

    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:22,代码来源:MucFilterProcessor.java

示例5: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
/**
 * Here we process the response of the remote command sent to Spectrum. We have to identify what kind of response it
 * is, as no tag for the command being responded is being sent. Currently these commands are used in Gojara
 * TransportSessionManager: online_users ( Chatmsg of online users for specific transport), usernames seperated by
 * newlines
 */
@Override
public void process(Packet packet, String subdomain, String to, String from) throws PacketRejectedException {
    Message message = (Message) packet;

    // handle different commands
    Log.debug("Intercepted spectrum message: " + message.toString());
    String command = packet.getID();
    if (command.equals("online_users")) {
        handleOnlineUsers(message, subdomain);
    } else if (command.equals("unregister")) {
        handleUnregister(message, subdomain);
    } else if (command.equals("config_check")) {
        handleConfigCheck(subdomain);
    } else if (command.equals("uptime")) {
        handleStatistic(message, subdomain, "uptime");
    } else if (command.equals("messages_from_xmpp")) {
        handleStatistic(message, subdomain, "messages_from_xmpp");
    } else if (command.equals("messages_to_xmpp")) {
        handleStatistic(message, subdomain, "messages_to_xmpp");
    } else if (command.equals("used_memory")) {
        handleStatistic(message, subdomain, "used_memory");
    } else if (command.equals("average_memory_per_user")) {
        handleStatistic(message, subdomain, "average_memory_per_user");
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:32,代码来源:GojaraAdminProcessor.java

示例6: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
/**
 * If this is valid disco#items package for this Use-Case we iterate through
 * the nodes and check if we have to remove nodes, this way they are not
 * shown to the user receiving this disco#items.
 * 
 * @param subdomain
 *            not the actual Subdomain here, as we have to use our set.
 */
@Override
public void process(Packet packet, String subdomain, String to, String from) throws PacketRejectedException {
    IQ myPacket = (IQ) packet;
    if (myPacket.getType().equals(IQ.Type.result) && (from.length() == 0 || from.equals(_server.getServerInfo().getXMPPDomain()))) {

        Log.debug("Processing packet in Whitelistprocessor for " + to + "Packet: " + packet.toString());
        Element root = myPacket.getChildElement();

        List<Node> nodes = XpathHelper.findNodesInDocument(root.getDocument(), "//discoitems:item");
        for (Node node : nodes) {
            String node_domain = node.valueOf("@jid");
            if (watchedSubdomains.contains(node_domain)) {
                if (_permissions.isGatewayLimited(node_domain) && !_permissions.allowedForUser(node_domain, myPacket.getTo()))
                    root.remove(node);
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:27,代码来源:WhitelistProcessor.java

示例7: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
@Override
public void process(Packet packet, String subdomain, String to, String from) throws PacketRejectedException {
    Log.debug("Processing packet in ClientToComponentUpdateProcessor: " + packet.toString());

    Element query = ((IQ) packet).getChildElement();
    List<Node> nodes = findNodesInDocument(query.getDocument(), "//roster:item");
    if (nodes.size() > 0) {
        // We now know we have to check the JID of the to be added User
        // against our valid subdomains.
        for (Node n : nodes) {
            String jid = n.valueOf("@jid");
            // TODO: We ignore remove iq packets for now. There might be
            // conflicts
            // when we remove our legacy network registration.
            String found_subdomain = searchJIDforSubdomain(jid);
            if (found_subdomain.length() > 0 && !n.valueOf("@subscription").equals("remove")) {

                Log.debug("Mirroring packet from local network to legacy component " + found_subdomain);
                IQ forward = (IQ) packet.createCopy();
                forward.setTo(found_subdomain);
                dispatchPacket(forward);
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:26,代码来源:ClientToComponentUpdateProcessor.java

示例8: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
/**
 * At this Point we know: MucBlock = true, !incoming, !processed Package is
 * IQ with Namespace disco#info, from equals the watched subdomain given
 * through subdomain
 */
@Override
public void process(Packet packet, String subdomain, String to, String from) throws PacketRejectedException {
	IQ iqPacket = (IQ) packet;

	if (iqPacket.getType().equals(IQ.Type.result) && to.length() > 0) {
		Element root = iqPacket.getChildElement();

		List<Node> nodes = XpathHelper.findNodesInDocument(root.getDocument(), "//disco:feature");
		for (Node node : nodes) {
			String var = node.valueOf("@var");
			if (var.equals("http://jabber.org/protocol/muc"))
				root.remove(node);
		}

	}
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:22,代码来源:MucFilterProcessor.java

示例9: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
/**
 * Here we process the response of the remote command sent to Spectrum. We have to identify what kind of response it
 * is, as no tag for the command being responded is being sent. Currently these commands are used in Gojara
 * TransportSessionManager: online_users ( Chatmsg of online users for specific transport), usernames seperated by
 * newlines
 */
@Override
public void process(Packet packet, String subdomain, String to, String from) throws PacketRejectedException {
	Message message = (Message) packet;

	// handle different commands
	Log.debug("Intercepted spectrum message: " + message.toString());
	String command = packet.getID();
	if (command.equals("online_users")) {
		handleOnlineUsers(message, subdomain);
	} else if (command.equals("unregister")) {
		handleUnregister(message, subdomain);
	} else if (command.equals("config_check")) {
		handleConfigCheck(subdomain);
	} else if (command.equals("uptime")) {
		handleStatistic(message, subdomain, "uptime");
	} else if (command.equals("messages_from_xmpp")) {
		handleStatistic(message, subdomain, "messages_from_xmpp");
	} else if (command.equals("messages_to_xmpp")) {
		handleStatistic(message, subdomain, "messages_to_xmpp");
	} else if (command.equals("used_memory")) {
		handleStatistic(message, subdomain, "used_memory");
	} else if (command.equals("average_memory_per_user")) {
		handleStatistic(message, subdomain, "average_memory_per_user");
	}
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:32,代码来源:GojaraAdminProcessor.java

示例10: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
/**
 * If this is valid disco#items package for this Use-Case we iterate through
 * the nodes and check if we have to remove nodes, this way they are not
 * shown to the user receiving this disco#items.
 * 
 * @param subdomain
 *            not the actual Subdomain here, as we have to use our set.
 */
@Override
public void process(Packet packet, String subdomain, String to, String from) throws PacketRejectedException {
	IQ myPacket = (IQ) packet;
	if (myPacket.getType().equals(IQ.Type.result) && (from.length() == 0 || from.equals(_server.getServerInfo().getXMPPDomain()))) {

		Log.debug("Processing packet in Whitelistprocessor for " + to + "Packet: " + packet.toString());
		Element root = myPacket.getChildElement();

		List<Node> nodes = XpathHelper.findNodesInDocument(root.getDocument(), "//discoitems:item");
		for (Node node : nodes) {
			String node_domain = node.valueOf("@jid");
			if (watchedSubdomains.contains(node_domain)) {
				if (_permissions.isGatewayLimited(node_domain) && !_permissions.allowedForUser(node_domain, myPacket.getTo()))
					root.remove(node);
			}
		}
	}
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:27,代码来源:WhitelistProcessor.java

示例11: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
@Override
public void process(Packet packet, String subdomain, String to, String from) throws PacketRejectedException {
	Log.debug("Processing packet in ClientToComponentUpdateProcessor: " + packet.toString());

	Element query = ((IQ) packet).getChildElement();
	List<Node> nodes = findNodesInDocument(query.getDocument(), "//roster:item");
	if (nodes.size() > 0) {
		// We now know we have to check the JID of the to be added User
		// against our valid subdomains.
		for (Node n : nodes) {
			String jid = n.valueOf("@jid");
			// TODO: We ignore remove iq packets for now. There might be
			// conflicts
			// when we remove our legacy network registration.
			String found_subdomain = searchJIDforSubdomain(jid);
			if (found_subdomain.length() > 0 && !n.valueOf("@subscription").equals("remove")) {

				Log.debug("Mirroring packet from local network to legacy component " + found_subdomain);
				IQ forward = (IQ) packet.createCopy();
				forward.setTo(found_subdomain);
				dispatchPacket(forward);
			}
		}
	}
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:26,代码来源:ClientToComponentUpdateProcessor.java

示例12: interceptPacket

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
@Override
public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed)
		throws PacketRejectedException {
	JID from = packet.getFrom();
	JID to = packet.getTo();

	if (from != null && to != null && processed && incoming) {
		if (from.toString().contains(_subdomain) || to.toString().contains(_subdomain)) {
			/*
			 * Spectrum sends a Ping to itself through the server to check
			 * if the server is alive. We ignore that for statistics
			 */
			if (to.toString().equals(from.toString()) && to.toString().equals(_subdomain))
				return;
			String type = packet.getClass().getName();
			_db.addNewLogEntry(_subdomain, type, from.toString(), to.toString());
		}
	}
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:20,代码来源:StatisticPackageInterceptor.java

示例13: interceptPacket

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
@Override
public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed)
		throws PacketRejectedException {
	if (_permissions.isGatewayLimited(_subDomain)) {
		if (packet instanceof IQ) {
			IQ iqpacket = (IQ) packet;
			Element root = iqpacket.getChildElement();
			if (root == null)
				return; 
			
			String ns = root.getNamespaceURI();
			if (ns.equals("http://jabber.org/protocol/disco#items") && iqpacket.getType().equals(IQ.Type.result)) {
				if (!_permissions.allowedForUser(_subDomain, iqpacket.getTo())) {
					if (iqpacket.getFrom().toString().equals(_host)) {
						List<Node> nodes = XpathHelper.findNodesInDocument(root.getDocument(), "//discoitems:item");
						for (Node node : nodes) {
							if (node.valueOf("@jid").equals(_subDomain)) {
								root.remove(node);
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:27,代码来源:DiscoPackageInterceptorHandler.java

示例14: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
@Override
public void process(Packet packet) throws PacketRejectedException {
	Log.debug("Processing packet in NonPersistantRosterProcessor for " + _subDomain);
	Presence myPacket = (Presence) packet;
	String to = myPacket.getTo().toString();
	String username = getUsernameFromJid(to);
	if (myPacket.getType() != null && myPacket.getType().equals(Presence.Type.unavailable)) {
		try {
			Roster roster = _rosterManager.getRoster(username);
			Collection<RosterItem> items = roster.getRosterItems();
			for (RosterItem item : items) {
				String itemName = item.getJid().toString();
				if (itemName.contains(_subDomain) && !itemName.equals(_subDomain)) {
					Log.debug("Removing contact " + item.getJid().toString() + " from contact list.");
					roster.deleteRosterItem(item.getJid(), false);
				}
			}
			
		} catch (Exception e) {
			Log.debug("Execption occured when cleaning up the Roster.", e);
			e.printStackTrace();
		} 

	}
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:26,代码来源:NonPersistantRosterProcessor.java

示例15: process

import org.jivesoftware.openfire.interceptor.PacketRejectedException; //导入依赖的package包/类
@Override
public void process(Packet packet) throws PacketRejectedException {
	Log.debug("Processing packet in SendRosterProcessor for " + _componentName);
	IQ myPacket = (IQ) packet;

	String user = myPacket.getTo().toString();
	String username = getUsernameFromJid(user);

	Roster roster;
	if(JiveGlobals.getBooleanProperty("plugin.remoteroster.persistent", false)){
		try {
			roster = _rosterManager.getRoster(username);
			Collection<RosterItem> items = roster.getRosterItems();
			sendRosterToComponent(myPacket, items);
		} catch (UserNotFoundException e) {
			e.printStackTrace();
		}
	} else {
		sendEmptyRoster(myPacket);
	}
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:22,代码来源:SendRosterProcessor.java


注:本文中的org.jivesoftware.openfire.interceptor.PacketRejectedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。