Commit bb9d52c0 authored by Dele Olajide's avatar Dele Olajide Committed by Guus der Kinderen

websocket plugin has been broken since Openfire 4.1.4. This PR implements the...

websocket plugin has been broken since Openfire 4.1.4. This PR implements the missing code and fixes the issue

    @Override
   public ConnectionConfiguration getConfiguration()
   {
       // TODO Here we run into an issue with the ConnectionConfiguration introduced in Openfire 4:
       //      it is not extensible in the sense that unforeseen connection types can be added.
       //      For now, null is returned, as this object is likely to be unused (its lifecycle is
       //      not managed by a ConnectionListener instance).
       return null;
   }
parent 4f5179c7
......@@ -8,8 +8,8 @@
<name>Openfire WebSocket</name>
<description>Provides WebSocket support for Openfire.</description>
<author>Tom Evans</author>
<version>1.2.0</version>
<date>05/08/2017</date>
<version>1.2.1</version>
<date>06/30/2017</date>
<url>https://tools.ietf.org/html/rfc7395</url>
<minServerVersion>4.2.0 Alpha</minServerVersion>
<minServerVersion>4.1.5</minServerVersion>
</plugin>
\ No newline at end of file
......@@ -18,11 +18,14 @@ package org.jivesoftware.openfire.websocket;
import java.net.InetSocketAddress;
import org.dom4j.Namespace;
import org.jivesoftware.openfire.*;
import org.jivesoftware.openfire.PacketDeliverer;
import org.jivesoftware.openfire.auth.UnauthorizedException;
import org.jivesoftware.openfire.net.VirtualConnection;
import org.jivesoftware.openfire.nio.OfflinePacketDeliverer;
import org.jivesoftware.openfire.spi.ConnectionConfiguration;
import org.jivesoftware.openfire.spi.ConnectionManagerImpl;
import org.jivesoftware.openfire.spi.ConnectionType;
import org.xmpp.packet.Packet;
import org.xmpp.packet.StreamError;
......@@ -35,10 +38,13 @@ public class WebSocketConnection extends VirtualConnection
private InetSocketAddress remotePeer;
private XmppWebSocket socket;
private PacketDeliverer backupDeliverer;
private ConnectionConfiguration configuration;
private ConnectionType connectionType;
public WebSocketConnection(XmppWebSocket socket, InetSocketAddress remotePeer) {
this.socket = socket;
this.remotePeer = remotePeer;
this.connectionType = ConnectionType.SOCKET_C2S;
}
@Override
......@@ -67,7 +73,7 @@ public class WebSocketConnection extends VirtualConnection
deliverRawText(new StreamError(StreamError.Condition.system_shutdown).toXML());
close();
}
@Override
public void deliver(Packet packet) throws UnauthorizedException
{
......@@ -112,15 +118,14 @@ public class WebSocketConnection extends VirtualConnection
return backupDeliverer;
}
@Override
public ConnectionConfiguration getConfiguration()
{
// TODO Here we run into an issue with the ConnectionConfiguration introduced in Openfire 4:
// it is not extensible in the sense that unforeseen connection types can be added.
// For now, null is returned, as this object is likely to be unused (its lifecycle is
// not managed by a ConnectionListener instance).
return null;
}
@Override
public ConnectionConfiguration getConfiguration() {
if (configuration == null) {
final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager());
configuration = connectionManager.getListener( connectionType, true ).generateConnectionConfiguration();
}
return configuration;
}
@Override
public boolean isCompressed() {
......
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