public void processMessage(Message message, HttpServletResponse res) throws IOException {
JID fromId = message.getFromJid();
Presence presence = xmppService.getPresence(fromId);
String presenceString = presence.isAvailable() ? "" : "not ";
SendResponse response = xmppService.sendMessage(
new MessageBuilder().
withBody(message.getBody() + " (you are " + presenceString + "available)").
withRecipientJids(fromId).
build());
for (Map.Entry<JID, SendResponse.Status> entry :
response.getStatusMap().entrySet()) {
res.getWriter().println(entry.getKey() + "," + entry.getValue() + "<br>");
}
res.getWriter().println("processed");
}