Commit abf0dc9d authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Ported latest changes made to trunk.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches@9083 b35dd754-fafc-0310-a699-88a17e54d16e
parent fe52cb58
......@@ -203,13 +203,27 @@ public class IQRouter extends BasicModule {
/**
* A JID is considered local if:
* 1) is null or
* 2) has no domain or domain is empty or
* 3) has no resource or resource is empty
* 2) has no domain or domain is empty
* or
* if it's not a full JID and it was sent to the server itself.
*
* @param recipientJID address to check.
* @return true if the specified address belongs to the local server.
*/
private boolean isLocalServer(JID recipientJID) {
return recipientJID == null || recipientJID.getDomain() == null
|| "".equals(recipientJID.getDomain()) || recipientJID.getResource() == null
|| "".equals(recipientJID.getResource());
// Check if no address was specified in the IQ packet
boolean implicitServer =
recipientJID == null || recipientJID.getDomain() == null || "".equals(recipientJID.getDomain());
if (!implicitServer) {
// We found an address. Now check if it's a bare or full JID
if (recipientJID.getNode() == null || recipientJID.getResource() == null) {
// Address is a bare JID so check if it was sent to the server itself
return serverName.equals(recipientJID.getDomain());
}
// Address is a full JID. IQ packets sent to full JIDs are not handle by the server
return false;
}
return true;
}
private void handle(IQ packet) {
......@@ -297,7 +311,7 @@ public class IQRouter extends BasicModule {
}
}
else {
// JID is of the form <node@domain/resource>
// JID is of the form <node@domain/resource> or belongs to a remote server
routingTable.routePacket(recipientJID, packet, false);
}
}
......
......@@ -410,6 +410,9 @@ public class XMPPServer {
finishSetup.start();
// We can now safely indicate that setup has finished
setupMode = false;
// Update server info
xmppServerInfo = new XMPPServerInfoImpl(name, version, startDate, getConnectionManager());
}
}
......
......@@ -32,7 +32,7 @@ import java.util.concurrent.LinkedBlockingQueue;
*/
public class ClusterManager {
private static String CLUSTER_PROPERTY_NAME = "cache.clustering.enabled";
private static String CLUSTER_PROPERTY_NAME = "clustering.enabled";
private static Queue<ClusterEventListener> listeners = new ConcurrentLinkedQueue<ClusterEventListener>();
private static BlockingQueue<Event> events = new LinkedBlockingQueue<Event>();
......
......@@ -51,7 +51,7 @@ public class HttpSession extends LocalClientSession {
private int maxPollingInterval;
private long lastPoll = -1;
private Set<SessionListener> listeners = new CopyOnWriteArraySet<SessionListener>();
private boolean isClosed;
private volatile boolean isClosed;
private int inactivityTimeout;
private long lastActivity;
private long lastRequestID;
......@@ -124,7 +124,7 @@ public class HttpSession extends LocalClientSession {
* Closes the session. After a session has been closed it will no longer accept new connections
* on the session ID.
*/
public synchronized void close() {
public void close() {
if (isClosed) {
return;
}
......
......@@ -11,10 +11,11 @@
package org.jivesoftware.openfire.ldap;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.user.*;
import org.jivesoftware.util.JiveConstants;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import org.jivesoftware.openfire.user.*;
import org.xmpp.packet.JID;
import javax.naming.NamingEnumeration;
......@@ -70,13 +71,11 @@ public class LdapUserProvider implements UserProvider {
}
public User loadUser(String username) throws UserNotFoundException {
String userDomain = JiveGlobals.getProperty("xmpp.domain");
if(username.contains("@")) {
userDomain = username.substring((username.lastIndexOf("@")+1));
username = username.substring(0,username.lastIndexOf("@"));
if (!XMPPServer.getInstance().isLocal(new JID(username))) {
throw new UserNotFoundException("Cannot load user of remote server: " + username);
}
if(!userDomain.equals(JiveGlobals.getProperty("xmpp.domain"))) {
throw new UserNotFoundException("Unknown domain: "+userDomain);
username = username.substring(0,username.lastIndexOf("@"));
}
// Un-escape username.
username = JID.unescapeNode(username);
......
/**
* $RCSfile: $
* $Revision: $
* $Date: $
*
* Copyright (C) 2007 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.openfire.muc.cluster;
import org.dom4j.Element;
import org.jivesoftware.openfire.muc.MUCRole;
import org.jivesoftware.openfire.muc.NotAllowedException;
import org.jivesoftware.openfire.muc.spi.LocalMUCRoom;
import org.jivesoftware.util.cache.ExternalizableUtil;
import org.xmpp.packet.Presence;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
/**
* Task that requests the cluster node hosting a room occupant to change his
* role and/or affiliation. If the occupant was not found or the change is
* not allowed then a <tt>null</tt> value is returned. Otherwise the DOM
* object representing the new presence of the room occupant is returned.
*
* @author Gaston Dombiak
*/
public class UpdateOccupantRequest extends MUCRoomTask {
private Element answer;
private String nickname;
private int role;
private int affiliation;
public UpdateOccupantRequest() {
}
public UpdateOccupantRequest(LocalMUCRoom room, String nickname, MUCRole.Affiliation newAffiliation,
MUCRole.Role newRole) {
super(room);
this.nickname = nickname;
this.role = newRole.ordinal();
this.affiliation = newAffiliation.ordinal();
}
public String getNickname() {
return nickname;
}
public MUCRole.Role getRole() {
return MUCRole.Role.values()[role];
}
public MUCRole.Affiliation getAffiliation() {
return MUCRole.Affiliation.values()[affiliation];
}
public Object getResult() {
return answer;
}
public void run() {
try {
Presence presence = getRoom().updateOccupant(this);
if (presence != null) {
answer = presence.getElement();
}
} catch (NotAllowedException e) {
// Do nothing. A null return value means that the operation failed
}
}
public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, nickname);
ExternalizableUtil.getInstance().writeInt(out, role);
ExternalizableUtil.getInstance().writeInt(out, affiliation);
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
nickname = ExternalizableUtil.getInstance().readSafeUTF(in);
role = ExternalizableUtil.getInstance().readInt(in);
affiliation = ExternalizableUtil.getInstance().readInt(in);
}
}
\ No newline at end of file
......@@ -1099,6 +1099,7 @@ public class LocalMUCRoom implements MUCRoom {
// Collect all the updated presences of these roles
for (MUCRole role : roles) {
// Update the presence with the new affiliation and role
if (role.isLocal()) {
role.setAffiliation(newAffiliation);
role.setRole(newRole);
// Notify the othe cluster nodes to update the occupant
......@@ -1106,6 +1107,21 @@ public class LocalMUCRoom implements MUCRoom {
// Prepare a new presence to be sent to all the room occupants
presences.add(role.getPresence().createCopy());
}
else {
// Ask the cluster node hosting the occupant to make the changes. Note that if the change
// is not allowed a NotAllowedException will be thrown
Element element = (Element) CacheFactory.doSynchronousClusterTask(
new UpdateOccupantRequest(this, role.getNickname(), newAffiliation, newRole),
role.getNodeID().toByteArray());
if (element != null) {
// Prepare a new presence to be sent to all the room occupants
presences.add(new Presence(element, true));
}
else {
throw new NotAllowedException();
}
}
}
// Answer all the updated presences
return presences;
}
......@@ -1467,17 +1483,43 @@ public class LocalMUCRoom implements MUCRoom {
}
public void occupantUpdated(UpdateOccupant update) {
RemoteMUCRole occupantRole = (RemoteMUCRole) occupants.get(update.getNickname().toLowerCase());
MUCRole occupantRole = occupants.get(update.getNickname().toLowerCase());
if (occupantRole != null) {
if (!occupantRole.isLocal()) {
occupantRole.setPresence(update.getPresence());
try {
occupantRole.setRole(update.getRole());
occupantRole.setAffiliation(update.getAffiliation());
} catch (NotAllowedException e) {
// Ignore. Should never happen with remote roles
}
}
else {
Log.error("Tried to update local occupant with info of local occupant?. Occupant nickname: " +
update.getNickname());
}
}
else {
Log.debug("Failed to update information of room occupant. Occupant nickname: " + update.getNickname());
}
}
public Presence updateOccupant(UpdateOccupantRequest updateRequest) throws NotAllowedException {
MUCRole occupantRole = occupants.get(updateRequest.getNickname().toLowerCase());
if (occupantRole != null) {
occupantRole.setAffiliation(updateRequest.getAffiliation());
occupantRole.setRole(updateRequest.getRole());
// Notify the othe cluster nodes to update the occupant
CacheFactory.doClusterTask(new UpdateOccupant(this, occupantRole));
return occupantRole.getPresence();
}
else {
Log.debug("Failed to update information of local room occupant. Occupant nickname: " +
updateRequest.getNickname());
}
return null;
}
public void nicknameChanged(MUCRole occupantRole, Presence newPresence, String oldNick, String newNick) {
// Ask other cluster nodes to update the nickname of the occupant
ChangeNickname request = new ChangeNickname(this, oldNick, newNick, newPresence.createCopy());
......
......@@ -218,6 +218,12 @@ public class SASLAuthentication {
token = new byte[0];
}
}
if (mechanism.equals("DIGEST-MD5")) {
// RFC2831 (DIGEST-MD5) says the client MAY provide an initial response on subsequent
// authentication. Java SASL does not (currently) support this and thows an exception
// if we try. This violates the RFC, so we just strip any initial token.
token = new byte[0];
}
byte[] challenge = ss.evaluateResponse(token);
if (ss.isComplete()) {
authenticationSuccessful(session, ss.getAuthorizationID(),
......
......@@ -32,6 +32,7 @@ import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.StringUtils;
import org.jivesoftware.util.lock.LockManager;
import org.jivesoftware.util.cache.Cache;
import org.jivesoftware.util.cache.CacheFactory;
import org.xmpp.packet.JID;
......@@ -44,6 +45,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.locks.Lock;
/**
* Simple in memory implementation of the PresenceManager interface.
......@@ -501,7 +503,10 @@ public class PresenceManagerImpl extends BasicModule implements PresenceManager
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
Lock lock = LockManager.getLock(username + "pr");
try {
lock.lock();
if (!offlinePresenceCache.containsKey(username) || !lastActivityCache.containsKey(username)) {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_OFFLINE_PRESENCE);
pstmt.setString(1, username);
......@@ -520,11 +525,13 @@ public class PresenceManagerImpl extends BasicModule implements PresenceManager
lastActivityCache.put(username, NULL_LONG);
}
}
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
DbConnectionManager.closeConnection(rs, pstmt, con);
lock.unlock();
}
}
}
\ No newline at end of file
......@@ -12,8 +12,13 @@
package org.jivesoftware.openfire.user;
import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.util.*;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.auth.AuthFactory;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.StringUtils;
import org.xmpp.packet.JID;
import java.sql.*;
import java.util.*;
......@@ -57,13 +62,11 @@ public class DefaultUserProvider implements UserProvider {
"UPDATE jiveUser SET modificationDate=? WHERE username=?";
public User loadUser(String username) throws UserNotFoundException {
String userDomain = JiveGlobals.getProperty("xmpp.domain");
if(username.contains("@")) {
userDomain = username.substring((username.lastIndexOf("@")+1));
username = username.substring(0,username.lastIndexOf("@"));
if (!XMPPServer.getInstance().isLocal(new JID(username))) {
throw new UserNotFoundException("Cannot load user of remote server: " + username);
}
if(!userDomain.equals(JiveGlobals.getProperty("xmpp.domain"))) {
throw new UserNotFoundException("Unknown domain: "+userDomain);
username = username.substring(0,username.lastIndexOf("@"));
}
Connection con = null;
PreparedStatement pstmt = null;
......
......@@ -11,9 +11,11 @@
package org.jivesoftware.openfire.user;
import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.StringUtils;
import org.xmpp.packet.JID;
import java.sql.*;
import java.util.*;
......@@ -97,13 +99,11 @@ public class JDBCUserProvider implements UserProvider {
}
public User loadUser(String username) throws UserNotFoundException {
String userDomain = JiveGlobals.getProperty("xmpp.domain");
if(username.contains("@")) {
userDomain = username.substring((username.lastIndexOf("@")+1));
username = username.substring(0,username.lastIndexOf("@"));
if (!XMPPServer.getInstance().isLocal(new JID(username))) {
throw new UserNotFoundException("Cannot load user of remote server: " + username);
}
if(!userDomain.equals(JiveGlobals.getProperty("xmpp.domain"))) {
throw new UserNotFoundException("Unknown domain: "+userDomain);
username = username.substring(0,username.lastIndexOf("@"));
}
Connection con = null;
PreparedStatement pstmt = null;
......
......@@ -74,7 +74,8 @@ be configured under Server/Server Manager/System Properties:
by letting anyone send broadcast messages to groups.</li>
<li><tt>plugin.broadcast.allowedUsers</tt> -- the comma-delimitted list of users allowed
to broadcast messages to all connected users at once. When this property isn't set,
anyone is allowed to broadcast messages to all users.</li>
anyone is allowed to broadcast messages to all users. Users should be specified by their
bare JID (e.g. john@myserver.com)</li>
</ul>
<h2>Using the Plugin</h2>
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Broadcast Plugin Changelog</title>
<style type="text/css">
BODY {
font-size : 100%;
}
BODY, TD, TH {
font-family : tahoma, verdana, arial, helvetica, sans-serif;
font-size : 0.8em;
}
H2 {
font-size : 10pt;
font-weight : bold;
padding-left : 1em;
}
A:hover {
text-decoration : none;
}
H1 {
font-family : tahoma, arial, helvetica, sans-serif;
font-size : 1.4em;
font-weight: bold;
border-bottom : 1px #ccc solid;
padding-bottom : 2px;
}
TT {
font-family : courier new;
font-weight : bold;
color : #060;
}
PRE {
font-family : courier new;
font-size : 100%;
}
</style>
</head>
<body>
<h1>
XML Debugger Plugin Changelog
</h1>
<p><b>1.0.0</b> -- September 5, 2007</p>
<ul>
<li>Initial release.</li>
</ul>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
Plugin configuration for the sessions debugger plugin.
-->
<plugin>
<class>org.jivesoftware.openfire.plugin.DebuggerPlugin</class>
<name>Debugger Plugin</name>
<description>Prints XML traffic to the stdout (raw and interpreted XML)</description>
<author>Jive Software</author>
<version>1.0</version>
<minServerVersion>3.2.0</minServerVersion>
</plugin>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>XML Debugger Plugin Readme</title>
<style type="text/css">
BODY {
font-size : 100%;
}
BODY, TD, TH {
font-family : tahoma, verdana, arial, helvetica, sans-serif;
font-size : 0.8em;
}
H2 {
font-size : 10pt;
font-weight : bold;
}
A:hover {
text-decoration : none;
}
H1 {
font-family : tahoma, arial, helvetica, sans-serif;
font-size : 1.4em;
font-weight: bold;
border-bottom : 1px #ccc solid;
padding-bottom : 2px;
}
TT {
font-family : courier new;
font-weight : bold;
color : #060;
}
PRE {
font-family : courier new;
font-size : 100%;
}
</style>
</head>
<body>
<h1>
XML Debugger Plugin Readme
</h1>
<h2>Overview</h2>
<p>
The xml debugger plugin prints XML traffic to the stdout. The plugin will print raw XML as it
was received and sent by the server as well as interpreted XML (i.e. parsed XML). By default the
plugin will only print raw XML.
</p>
<h2>Installation</h2>
<p>Copy xmldebugger.jar into the plugins directory of your Openfire installation. The
plugin will then be automatically deployed. To upgrade to a new version, copy the new
xmldebugger.jar file over the existing file.</p>
<h2>Configuration</h2>
The debugger plugin is configured via Openfire system properties. These can
be configured under Server/Server Manager/System Properties:
<ul>
<li><tt>plugin.debugger.interpretedAllowed</tt> -- true to print XML packets
after they were parsed by the server. This only includes incoming traffic. The
default value is false.</li>
</ul>
<h2>Using the Plugin</h2>
Traffic generated by sessions created after the plugin was installed will be captured and
printed.
</body>
</html>
/**
* $RCSfile: $
* $Revision: $
* $Date: $
*
* Copyright (C) 2007 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.openfire.plugin;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.openfire.interceptor.InterceptorManager;
import org.jivesoftware.openfire.spi.ConnectionManagerImpl;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.PropertyEventDispatcher;
import org.jivesoftware.util.PropertyEventListener;
import java.io.File;
import java.util.Map;
/**
* Debugger plugin that prints XML traffic to stdout. By default it will only print
* raw XML traffic (by using a MINA filter). To turn on printing of interpreted XML
* (i.e. parsed XML) just enable the system property <tt>plugin.debugger.interpretedAllowed</tt>.
* There is no need to restart the plugin or the server.
*
* @author Gaston Dombiak
*/
public class DebuggerPlugin implements Plugin, PropertyEventListener {
private RawPrintFilter defaultPortFilter;
private RawPrintFilter oldPortFilter;
private InterpretedXMLPrinter interpretedPrinter;
public void initializePlugin(PluginManager manager, File pluginDirectory) {
// Add filter to filter chain builder
ConnectionManagerImpl connManager = (ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager();
defaultPortFilter = new RawPrintFilter();
connManager.getSocketAcceptor().getFilterChain().addBefore("xmpp", "rawDebugger", defaultPortFilter);
oldPortFilter = new RawPrintFilter();
connManager.getSSLSocketAcceptor().getFilterChain().addBefore("xmpp", "rawDebugger", oldPortFilter);
interpretedPrinter = new InterpretedXMLPrinter();
if (JiveGlobals.getBooleanProperty("plugin.debugger.interpretedAllowed")) {
// Add the packet interceptor that prints interpreted XML
InterceptorManager.getInstance().addInterceptor(interpretedPrinter);
}
// Listen to property events
PropertyEventDispatcher.addListener(this);
}
public void destroyPlugin() {
// Stop listening to property events
PropertyEventDispatcher.removeListener(this);
// Remove filter from filter chain builder
ConnectionManagerImpl connManager = (ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager();
if (connManager.getSocketAcceptor().getFilterChain().contains("rawDebugger")) {
connManager.getSocketAcceptor().getFilterChain().remove("rawDebugger");
}
if (connManager.getSSLSocketAcceptor().getFilterChain().contains("rawDebugger")) {
connManager.getSSLSocketAcceptor().getFilterChain().remove("rawDebugger");
}
// Remove the filters from existing sessions
if (defaultPortFilter != null) {
defaultPortFilter.shutdown();
}
if (oldPortFilter != null) {
oldPortFilter.shutdown();
}
// Remove the packet interceptor that prints interpreted XML
InterceptorManager.getInstance().removeInterceptor(interpretedPrinter);
defaultPortFilter = null;
oldPortFilter = null;
interpretedPrinter = null;
}
public void propertySet(String property, Map<String, Object> params) {
if (property.equals("plugin.debugger.interpretedAllowed")) {
if (Boolean.parseBoolean((String)params.get("value"))) {
InterceptorManager.getInstance().addInterceptor(interpretedPrinter);
}
else {
InterceptorManager.getInstance().removeInterceptor(interpretedPrinter);
}
}
}
public void propertyDeleted(String property, Map<String, Object> params) {
if (property.equals("plugin.debugger.interpretedAllowed")) {
InterceptorManager.getInstance().removeInterceptor(interpretedPrinter);
}
}
public void xmlPropertySet(String property, Map<String, Object> params) {
// Do nothing
}
public void xmlPropertyDeleted(String property, Map<String, Object> params) {
// Do nothing
}
}
/**
* $RCSfile: $
* $Revision: $
* $Date: $
*
* Copyright (C) 2007 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.openfire.plugin;
import org.jivesoftware.openfire.interceptor.PacketInterceptor;
import org.jivesoftware.openfire.interceptor.PacketRejectedException;
import org.jivesoftware.openfire.session.Session;
import org.xmpp.packet.Packet;
/**
* Packet interceptor that prints to the stdout XML packets (i.e. XML after
* it was parsed).<p>
*
* If you find in the logs an entry for raw XML, an entry that a session was closed and
* never find the corresponding interpreted XML for the raw XML then there was an error
* while parsing the XML that closed the session.
*
* @author Gaston Dombiak.
*/
public class InterpretedXMLPrinter implements PacketInterceptor {
public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed)
throws PacketRejectedException {
if (!processed && incoming) {
System.out.println("INTERPRETED: " + packet.toXML());
}
}
}
/**
* $RCSfile: $
* $Revision: $
* $Date: $
*
* Copyright (C) 2007 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.openfire.plugin;
import org.apache.mina.common.ByteBuffer;
import org.apache.mina.common.IoFilterAdapter;
import org.apache.mina.common.IoSession;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.util.Collection;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* MINA filter that prints to the stdout received XML stanzas before they are actually parsed and
* also prints XML stanzas as sent to the XMPP entities. Moreover, it also prints information when
* a session is closed.
*
* @author Gaston Dombiak
*/
public class RawPrintFilter extends IoFilterAdapter {
private Collection<IoSession> sessions = new ConcurrentLinkedQueue<IoSession>();
public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception {
// Decode the bytebuffer and print it to the stdout
if (message instanceof ByteBuffer) {
ByteBuffer byteBuffer = (ByteBuffer) message;
// Keep current position in the buffer
int currentPos = byteBuffer.position();
// Decode buffer
Charset encoder = Charset.forName("UTF-8");
CharBuffer charBuffer = encoder.decode(byteBuffer.buf());
// Print buffer content
System.out.println("RECV (" + session.hashCode() + "): " + charBuffer);
// Reset to old position in the buffer
byteBuffer.position(currentPos);
}
// Pass the message to the next filter
super.messageReceived(nextFilter, session, message);
}
public void messageSent(NextFilter nextFilter, IoSession session, Object message) throws Exception {
System.out.println("SENT (" + session.hashCode() + "): " +
Charset.forName("UTF-8").decode(((ByteBuffer) message).buf()));
// Pass the message to the next filter
super.messageSent(nextFilter, session, message);
}
public void shutdown() {
// Remove this filter from sessions that are using it
for (IoSession session : sessions) {
session.getFilterChain().remove("rawDebugger");
}
sessions = null;
}
public void sessionCreated(NextFilter nextFilter, IoSession session) throws Exception {
// Keep track of sessions using this filter
sessions.add(session);
super.sessionCreated(nextFilter, session);
}
public void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception {
// Update list of sessions using this filter
sessions.remove(session);
// Print that a session was closed
System.out.println("CLOSED (" + session.hashCode() + ") ");
super.sessionClosed(nextFilter, session);
}
}
\ No newline at end of file
......@@ -4,14 +4,14 @@
- $Date: 2005-05-26 23:00:40 -0700 (Thu, 26 May 2005) $
--%>
<%@ page import="org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.openfire.XMPPServer,
<%@ page import="org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.openfire.auth.AuthFactory,
org.jivesoftware.openfire.ldap.LdapManager,
org.jivesoftware.openfire.user.User" %>
<%@ page import="org.jivesoftware.openfire.user.UserManager"%>
org.jivesoftware.openfire.user.User,
org.jivesoftware.openfire.user.UserManager,
org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.ParamUtils" %>
<%@ page import="org.jivesoftware.util.StringUtils"%>
<%@ page import="org.xmpp.packet.JID"%>
<%@ page import="javax.servlet.http.HttpSession" %>
<%@ page import="java.net.URLEncoder" %>
......@@ -100,7 +100,8 @@
return;
}
catch (Exception e) {
System.err.println("Could not find UserManager");
//System.err.println("Could not find UserManager");
e.printStackTrace();
errors.put("general", "There was an unexpected error encountered when "
+ "setting the new admin information. Please check your error "
+ "logs and try to remedy the problem.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment