diff --git a/ConnectionManager.iml b/ConnectionManager.iml
index 8f801bc..e7c7005 100644
--- a/ConnectionManager.iml
+++ b/ConnectionManager.iml
@@ -75,7 +75,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/lib/jetty-util.jar b/build/lib/jetty-util.jar
new file mode 100644
index 0000000..f1b2e29
--- /dev/null
+++ b/build/lib/jetty-util.jar
Binary files differ
diff --git a/build/lib/jetty.jar b/build/lib/jetty.jar
new file mode 100644
index 0000000..29f077d
--- /dev/null
+++ b/build/lib/jetty.jar
Binary files differ
diff --git a/build/lib/servlet-api.jar b/build/lib/servlet-api.jar
new file mode 100644
index 0000000..a604b6f
--- /dev/null
+++ b/build/lib/servlet-api.jar
Binary files differ
diff --git a/build/lib/versions.txt b/build/lib/versions.txt
index 7267dfa..da0365f 100644
--- a/build/lib/versions.txt
+++ b/build/lib/versions.txt
@@ -7,9 +7,12 @@
commons-el.jar | Jetty 5.1.10
dom4j.jar | 1.6.1
!jaxen.jar | 1.1 beta 4 (from DOM4J 1.6.1)
+jetty.jar | 6.0.1
+jetty-util.jar | 6.0.1
junit.jar | 3.8.1
jdic.jar | 0.9.1 (for windows only)
jzlib.jar | 1.0.7
pack200task.jar | August 5, 2004
+servlet-api.jar | 2.5-6.0.1
xmltask.jar | 1.11
xpp3.jar | XPP_3 1.1.3.8
\ No newline at end of file
diff --git a/src/conf/manager.xml b/src/conf/manager.xml
index 52c9228..1849d54 100644
--- a/src/conf/manager.xml
+++ b/src/conf/manager.xml
@@ -74,6 +74,9 @@
-->
+
+ false
+
diff --git a/src/i18n/cmanager_i18n_cs_CZ.properties b/src/i18n/cmanager_i18n_cs_CZ.properties
index d196943..e9ac70b 100644
--- a/src/i18n/cmanager_i18n_cs_CZ.properties
+++ b/src/i18n/cmanager_i18n_cs_CZ.properties
@@ -46,6 +46,7 @@
admin.error.socket-setup=Nelze nastavit socket serveru
admin.error.ssl=Nelze nastavit SSL socket
admin.error.stream=Detekov\u00e1na chyba streamu
+admin.error.http.bind=Error starting http bind servlet
admin.drop-packet=Zahozen nerozpoznan\u00fd paket
admin.disconnect=Stream zkr\u00e1cen\u011b ukon\u010den (mohl b\u00fdt ukon\u010den norm\u00e1ln\u011b)
diff --git a/src/i18n/cmanager_i18n_de.properties b/src/i18n/cmanager_i18n_de.properties
index de1cc56..5a69102 100644
--- a/src/i18n/cmanager_i18n_de.properties
+++ b/src/i18n/cmanager_i18n_de.properties
@@ -47,6 +47,7 @@
admin.error.socket-setup=Kann kein Server-Socket einrichten
admin.error.ssl=Kann SSL-Socket nicht einrichten
admin.error.stream=Stream-Fehler entdeckt
+admin.error.http.bind=Error starting http bind servlet
admin.drop-packet=Unbekanntes Paket verworfen
admin.disconnect=Stream-Abschnitt kurz (k\u00f6nnte normale Trennung sein)
diff --git a/src/i18n/cmanager_i18n_en.properties b/src/i18n/cmanager_i18n_en.properties
index ae7f953..becc547 100644
--- a/src/i18n/cmanager_i18n_en.properties
+++ b/src/i18n/cmanager_i18n_en.properties
@@ -69,6 +69,7 @@
admin.error.socket-setup=Could not setup a server socket
admin.error.ssl=Could not setup SSL socket
admin.error.stream=Stream error detected
+admin.error.http.bind=Error starting http bind servlet
admin.drop-packet=Dropping unrecognized packet
admin.disconnect=Stream cut short (could be normal disconnect)
diff --git a/src/i18n/cmanager_i18n_es.properties b/src/i18n/cmanager_i18n_es.properties
index 1050700..0a9e7ce 100644
--- a/src/i18n/cmanager_i18n_es.properties
+++ b/src/i18n/cmanager_i18n_es.properties
@@ -41,6 +41,7 @@
admin.error.socket-setup=No se pudo establecer un socket de servidor
admin.error.ssl=No se pudo establecer un socket SSL
admin.error.stream=Se detect\u00f3 un error en el flujo de datos
+admin.error.http.bind=Error starting http bind servlet
admin.drop-packet=Descartando paquete no reconocido
admin.disconnect=Flujo de datos cortado prematuramente (pudo ser una desconexi\u00f3n normal)
diff --git a/src/i18n/cmanager_i18n_fr.properties b/src/i18n/cmanager_i18n_fr.properties
index 4a19328..84e6ce9 100644
--- a/src/i18n/cmanager_i18n_fr.properties
+++ b/src/i18n/cmanager_i18n_fr.properties
@@ -49,6 +49,7 @@
admin.error.socket-setup=Impossible de configurer un socket
admin.error.ssl=Impossible de configurer le socket SSL
admin.error.stream=Erreur de flux d\u00e9tect\u00e9e
+admin.error.http.bind=Error starting http bind servlet
admin.drop-packet=Rejet de paquet non reconnus
admin.disconnect=Flux coup\u00e9 court (peut-\u00eatre un d\u00e9connexion normale)
diff --git a/src/i18n/cmanager_i18n_nl.properties b/src/i18n/cmanager_i18n_nl.properties
index 4fe710a..b8f8fcd 100644
--- a/src/i18n/cmanager_i18n_nl.properties
+++ b/src/i18n/cmanager_i18n_nl.properties
@@ -45,6 +45,7 @@
admin.error.socket-setup=Kan geen server socket aanmaken
admin.error.ssl=Kan geen SSL socket aanmaken
admin.error.stream=Stream fout gedetecteerd
+admin.error.http.bind=Error starting http bind servlet
admin.drop-packet=Onherkend pakket wordt genegeerd
admin.disconnect=Stream voortijdig afgesloten (kan een normale verbroken verbinding zijn)
diff --git a/src/i18n/cmanager_i18n_pl_PL.properties b/src/i18n/cmanager_i18n_pl_PL.properties
index b1e345a..e9d3da7 100644
--- a/src/i18n/cmanager_i18n_pl_PL.properties
+++ b/src/i18n/cmanager_i18n_pl_PL.properties
@@ -49,6 +49,7 @@
admin.error.socket-setup=B\u0142\u0105d podczas inicjalizacji socketu na serwerze
admin.error.ssl=B\u0142\u0105d podczas inicjalizacji socketu SSL
admin.error.stream=Wykryto b\u0142\u0105d strumienia
+admin.error.http.bind=Error starting http bind servlet
admin.drop-packet=Porzucono nierozpoznany pakiet
admin.disconnect=Strumie\u0144 uci\u0119ty (could be normal disconnect)
diff --git a/src/i18n/cmanager_i18n_pt_BR.properties b/src/i18n/cmanager_i18n_pt_BR.properties
index 90cb892..8c8914a 100644
--- a/src/i18n/cmanager_i18n_pt_BR.properties
+++ b/src/i18n/cmanager_i18n_pt_BR.properties
@@ -46,6 +46,7 @@
admin.error.socket-setup=N\u00e3o \u00e9 poss\u00edvel definir um soquete de servidor
admin.error.ssl=N\u00e3o \u00e9 poss\u00edvel definir soquete SSL
admin.error.stream=Detectado erro de fluxo
+admin.error.http.bind=Error starting http bind servlet
admin.drop-packet=Liberando pacote n\u00e3o reconhecido
admin.disconnect=Fluxo cortado prematuramente (pode ser uma desconex\u00e3o normal)
diff --git a/src/i18n/cmanager_i18n_zh_CN.properties b/src/i18n/cmanager_i18n_zh_CN.properties
index 3849fe3..31381f0 100644
--- a/src/i18n/cmanager_i18n_zh_CN.properties
+++ b/src/i18n/cmanager_i18n_zh_CN.properties
@@ -45,6 +45,7 @@
admin.error.socket-setup=\u65e0\u6cd5\u8bbe\u7f6e\u670d\u52a1\u5668\u5957\u63a5\u5b57
admin.error.ssl=\u65e0\u6cd5\u8bbe\u7f6e SSL \u5957\u63a5\u5b57
admin.error.stream=\u68c0\u6d4b\u5230\u6d41\u9519\u8bef
+admin.error.http.bind=Error starting http bind servlet
admin.drop-packet=\u4e22\u5f03\u65e0\u6cd5\u8bc6\u522b\u7684\u6570\u636e\u5305
admin.disconnect=\u6d41\u622a\u65ad\uff08\u65e0\u6cd5\u6b63\u5e38\u65ad\u5f00\u8fde\u63a5\uff09
diff --git a/src/java/org/jivesoftware/multiplexer/ConnectionManager.java b/src/java/org/jivesoftware/multiplexer/ConnectionManager.java
index 2812fdf..28f5c4c 100644
--- a/src/java/org/jivesoftware/multiplexer/ConnectionManager.java
+++ b/src/java/org/jivesoftware/multiplexer/ConnectionManager.java
@@ -16,6 +16,7 @@
import org.jivesoftware.multiplexer.net.SSLSocketAcceptThread;
import org.jivesoftware.multiplexer.net.SocketAcceptThread;
import org.jivesoftware.multiplexer.net.SocketSendingTracker;
+import org.jivesoftware.multiplexer.net.http.HttpBindManager;
import org.jivesoftware.util.*;
import java.io.File;
@@ -102,6 +103,7 @@
private ServerSurrogate serverSurrogate;
private SocketAcceptThread socketThread;
private SSLSocketAcceptThread sslSocketThread;
+ private HttpBindManager httpBindManager;
/**
* Returns a singleton instance of ConnectionManager.
@@ -236,11 +238,14 @@
startClientListeners(localIPAddress);
// Start the port listener for secured clients
startClientSSLListeners(localIPAddress);
+ // Start http bind listener
+ startHttpBindServlet();
}
private void stopModules() {
stopClientListeners();
stopClientSSLListeners();
+ stopHttpBindServlet();
// Stop process that checks health of socket connections
SocketSendingTracker.getInstance().shutdown();
// Stop service that forwards packets to the server
@@ -319,6 +324,41 @@
}
}
+ private void startHttpBindServlet() {
+ boolean httpBindEnabled = JiveGlobals.getBooleanProperty("xmpp.httpbind.enabled", false);
+ if (!httpBindEnabled) {
+ return;
+ }
+
+ int plainPort = JiveGlobals.getIntProperty("xmpp.httpbind.port.plain", 8080);
+ int sslPort = JiveGlobals.getIntProperty("xmpp.httpbind.port.secure", 8443);
+ httpBindManager = new HttpBindManager(plainPort, sslPort);
+
+ try {
+ httpBindManager.startup();
+ }
+ catch (Exception e) {
+ httpBindManager = null;
+ System.err.println("Error starting http bind servlet " + plainPort + "and" + sslPort
+ + ": " + e.getMessage());
+ Log.error(LocaleUtils.getLocalizedString("admin.error.http.bind"), e);
+ }
+ }
+
+ private void stopHttpBindServlet() {
+ if (httpBindManager != null) {
+ try {
+ httpBindManager.shutdown();
+ }
+ catch (Exception e) {
+ Log.error(e);
+ }
+ finally {
+ httpBindManager = null;
+ }
+ }
+ }
+
/**
* Restarts the server and all it's modules only if the server is restartable. Otherwise do
* nothing.
diff --git a/src/java/org/jivesoftware/multiplexer/net/http/HttpBindManager.java b/src/java/org/jivesoftware/multiplexer/net/http/HttpBindManager.java
new file mode 100644
index 0000000..7406fe2
--- /dev/null
+++ b/src/java/org/jivesoftware/multiplexer/net/http/HttpBindManager.java
@@ -0,0 +1,52 @@
+/**
+ * $RCSfile: $
+ * $Revision: $
+ * $Date: $
+ *
+ * Copyright (C) 2006 Jive Software. All rights reserved.
+ * This software is the proprietary information of Jive Software. Use is subject to license terms.
+ */
+package org.jivesoftware.multiplexer.net.http;
+
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+
+/**
+ * Manages connections to the server which use the HTTP Bind protocol specified in
+ * XEP-0124. The manager maps a servlet
+ * to an embedded servlet container using the ports provided in the constructor.
+ *
+ * @author Alexander Wenckus
+ */
+public class HttpBindManager {
+ private int plainPort;
+ private int sslPort;
+ private Server server;
+
+ public HttpBindManager(int plainPort, int sslPort) {
+ this.plainPort = plainPort;
+ this.sslPort = sslPort;
+ this.server = new Server();
+ }
+
+ public void startup() throws Exception {
+ SelectChannelConnector connector = new SelectChannelConnector();
+ connector.setPort(plainPort);
+ server.setConnectors(new Connector[]{connector});
+
+ ServletHolder servletHolder = new ServletHolder(
+ new HttpBindServlet(new HttpSessionManager()));
+ ServletHandler servletHandler = new ServletHandler();
+ servletHandler.addServletWithMapping(servletHolder, "/");
+ server.addHandler(servletHandler);
+
+ server.start();
+ }
+
+ public void shutdown() throws Exception {
+ server.stop();
+ }
+}
diff --git a/src/java/org/jivesoftware/multiplexer/net/http/HttpBindServlet.java b/src/java/org/jivesoftware/multiplexer/net/http/HttpBindServlet.java
new file mode 100644
index 0000000..e6f4625
--- /dev/null
+++ b/src/java/org/jivesoftware/multiplexer/net/http/HttpBindServlet.java
@@ -0,0 +1,34 @@
+/**
+ * $RCSfile: $
+ * $Revision: $
+ * $Date: $
+ *
+ * Copyright (C) 2006 Jive Software. All rights reserved.
+ * This software is the proprietary information of Jive Software. Use is subject to license terms.
+ */
+package org.jivesoftware.multiplexer.net.http;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ *
+ */
+public class HttpBindServlet extends HttpServlet {
+ private HttpSessionManager sessionManager;
+
+ public HttpBindServlet(HttpSessionManager sessionManager) {
+ this.sessionManager = sessionManager;
+ }
+
+ @Override
+ protected void service(HttpServletRequest httpServletRequest,
+ HttpServletResponse httpServletResponse)
+ throws ServletException, IOException
+ {
+ super.service(httpServletRequest, httpServletResponse);
+ }
+}
diff --git a/src/java/org/jivesoftware/multiplexer/net/http/HttpSessionManager.java b/src/java/org/jivesoftware/multiplexer/net/http/HttpSessionManager.java
new file mode 100644
index 0000000..81b813d
--- /dev/null
+++ b/src/java/org/jivesoftware/multiplexer/net/http/HttpSessionManager.java
@@ -0,0 +1,15 @@
+/**
+ * $RCSfile: $
+ * $Revision: $
+ * $Date: $
+ *
+ * Copyright (C) 2006 Jive Software. All rights reserved.
+ * This software is the proprietary information of Jive Software. Use is subject to license terms.
+ */
+package org.jivesoftware.multiplexer.net.http;
+
+/**
+ *
+ */
+public class HttpSessionManager {
+}