/** * Helper method to send packets. * * @param packet * The packet to send. */ protected void send(Packet packet) { try { compMan.sendPacket(this, packet); } catch (ComponentException e) { log.warn("(serving component '" + getName() + "') Could not send packet!", e); } }
/** * Override this method to handle the IQ stanzas of type <tt>error</tt> that * are received by the component. If you do not override this method, the * stanzas are ignored. * * @param iq * The IQ stanza of type <tt>error</tt> that was received by this * component. */ protected void handleIQError(IQ iq) { // Doesn't do anything. Override this method to process IQ error // stanzas. log.info("(serving component '{}') IQ stanza " + "of type <tt>error</tt> received: ", getName(), iq.toXML()); }
/** * Pre-processes incoming message stanzas. This method checks for validity * of the messages (see {@link #servesLocalUsersOnly()}. If the stanza is * found to be legitimate, it is forwarded to * {@link #handleMessage(Message)}. * * @param message * The message stanza to process. */ final private void processMessage(Message message) { log.trace("(serving component '{}') Processing message stanza: {}", getName(), message.toXML()); if (servesLocalUsersOnly() && !sentByLocalEntity(message)) { log.info("(serving component '{}') Dropping message " + "stanza sent by a user from another domain: {}", getName(), message.getFrom()); log.debug("(serving component '{}') Dropping message " + "stanza sent by a user from another domain: {}", getName(), message.toXML()); return; } handleMessage(message); }
/** * Pre-processes incoming presence stanzas. This method checks for validity * of the messages (see {@link #servesLocalUsersOnly()}. If the stanza is * found to be legitimate, it is forwarded to * {@link #handlePresence(Presence)}. * * @param message * The presence stanza to process. */ final private void processPresence(Presence presence) { log.trace("(serving component '{}') Processing presence stanza: {}", getName(), presence.toXML()); if (servesLocalUsersOnly() && !sentByLocalEntity(presence)) { log.info("(serving component '{}') Dropping presence " + "stanza sent by a user from another domain: {}", getName(), presence.getFrom()); log.debug("(serving component '{}') Dropping presence " + "stanza sent by a user from another domain: {}", getName(), presence.toXML()); return; } handlePresence(presence); }
/** * @see org.xmpp.component.Component#processPacket(org.xmpp.packet.Packet) */ final public void processPacket(final Packet packet) { final Packet copy = packet.createCopy(); if (executor == null) { } try { executor.execute(new PacketProcessor(copy)); } catch (RejectedExecutionException ex) { log.error("(serving component '" + getName() + "') Unable to process packet! " + "Is the thread pool queue exhausted? " + "Packet dropped in component '" + getName() + "'. Packet that's dropped: " + packet.toXML(), ex); // If the original packet was an IQ request, we should return an // error. if (packet instanceof IQ && ((IQ) packet).isRequest()) { final IQ response = IQ.createResultIQ((IQ) packet); response.setError(Condition.internal_server_error); send(response); } } }
+ "request (packetId {}).", getName(), iq.getID()); log.debug("(serving component '{}') Invalid XMPP " + "- no child element or namespace in IQ " + "request (packetId {})", getName(), iq.getID()); log.info("(serving component '{}') Returning " + "'not-authorized' IQ error to a user from " + "another domain: {}", getName(), iq.getFrom()); log.debug("(serving component '{}') Returning " + "'not-authorized' IQ error to a user from " + "another domain: {}", getName(), iq.toXML()); final IQ error = IQ.createResultIQ(iq); error.setError(Condition.not_authorized); log.trace("(serving component '{}') " + "Calling #handleDiscoInfo() (packetId {}).", getName(), iq.getID()); return handleDiscoInfo(iq); } else if (NAMESPACE_DISCO_ITEMS.equals(namespace)) { log.trace("(serving component '{}') " + "Calling #handleDiscoItems() (packetId {}).", getName(), iq.getID()); return handleDiscoItems(iq); } else if (NAMESPACE_XMPP_PING.equals(namespace)) { log.trace("(serving component '{}') " + "Calling #handlePing() (packetId {}).", getName(), iq .getID()); return handlePing(iq);
new Object[] {getName(), iq.getID(), iq.toXML() }); + ". The response was: " + response.toXML()); log.debug("(serving component '{}') Responding to IQ (packetId {}) with: {}", new Object[] { getName(), iq.getID(), response.toXML() }); log.info("(serving component '{}') Dropping IQ " + "stanza sent by a user from another domain: {}", getName(), iq.getFrom()); log.debug("(serving component '{}') Dropping IQ " + "stanza sent by a user from another domain: {}", getName(), iq.toXML()); return; log.info("(serving component '{}') Dropping IQ " + "stanza sent by a user from another domain: {}", getName(), iq.getFrom()); log.debug("(serving component '{}') Dropping IQ " + "stanza sent by a user from another domain: {}", getName(), iq.toXML()); return; log.warn("(serving component '" + getName() + "') Unexpected exception while processing IQ stanza: " + iq.toXML(), ex);
discoInfoIdentityCategory()).addAttribute("type", discoInfoIdentityCategoryType()) .addAttribute("name", getName());