Remove Java web server

Applets don't work anymore so remove everything that has to do
with serving them.
diff --git a/win/rfb_win32/SDisplay.cxx b/win/rfb_win32/SDisplay.cxx
index ad55d49..9b2cbb0 100644
--- a/win/rfb_win32/SDisplay.cxx
+++ b/win/rfb_win32/SDisplay.cxx
@@ -314,21 +314,6 @@
 }
 
 
-Point SDisplay::getFbSize() {
-  bool startAndStop = !core;
-
-  // If not started, do minimal initialisation to get desktop size.
-  if (startAndStop)
-    recreatePixelBuffer();
-  Point result = Point(pb->width(), pb->height());
-
-  // Destroy the initialised structures.
-  if (startAndStop)
-    stopCore();
-  return result;
-}
-
-
 void
 SDisplay::notifyClipboardChanged(const char* text, int len) {
   vlog.debug("clipboard text changed");
diff --git a/win/rfb_win32/SDisplay.h b/win/rfb_win32/SDisplay.h
index f36b2b7..c1d5c1e 100644
--- a/win/rfb_win32/SDisplay.h
+++ b/win/rfb_win32/SDisplay.h
@@ -86,12 +86,6 @@
 
       void setStatusLocation(bool* status) {statusLocation = status;}
 
-      // -=- Used (indirectly) by JavaViewer to get desktop size
-
-      Point getFbSize();
-
-      friend class SDisplayCore;
-
       static IntParameter updateMethod;
       static BoolParameter disableLocalInputs;
       static StringParameter disconnectAction;
diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h
index b3402ab..c3d6737 100644
--- a/win/vncconfig/Connections.h
+++ b/win/vncconfig/Connections.h
@@ -27,8 +27,6 @@
 #include <rfb/Blacklist.h>
 #include <network/TcpSocket.h>
 
-static rfb::IntParameter http_port("HTTPPortNumber",
-  "TCP/IP port on which the server will serve the Java applet VNC Viewer ", 5800);
 static rfb::IntParameter port_number("PortNumber",
   "TCP/IP port on which the server will accept connections", 5900);
 static rfb::StringParameter hosts("Hosts",
@@ -96,10 +94,6 @@
         setItemInt(IDC_PORT, port_number ? port_number : 5900);
         setItemChecked(IDC_RFB_ENABLE, port_number != 0);
         setItemInt(IDC_IDLE_TIMEOUT, rfb::Server::idleTimeout);
-        vlog.debug("set IDC_HTTP_PORT %d", (int)http_port);
-        setItemInt(IDC_HTTP_PORT, http_port ? http_port : 5800);
-        setItemChecked(IDC_HTTP_ENABLE, http_port != 0);
-        enableItem(IDC_HTTP_PORT, http_port != 0);
         setItemChecked(IDC_LOCALHOST, localHost);
 
         HWND listBox = GetDlgItem(handle, IDC_HOSTS);
@@ -133,26 +127,14 @@
           return true;
 
         case IDC_PORT:
-          if (cmd == EN_CHANGE) {
-            try {
-              setItemInt(IDC_HTTP_PORT, rfbPortToHTTP(getItemInt(IDC_PORT)));
-            } catch (...) {
-            }
-          }
-        case IDC_HTTP_PORT:
         case IDC_IDLE_TIMEOUT:
           if (cmd == EN_CHANGE)
             setChanged(isChanged());
           return false;
 
-        case IDC_HTTP_ENABLE:
         case IDC_RFB_ENABLE:
         case IDC_LOCALHOST:
           {
-            // HTTP port
-            enableItem(IDC_HTTP_PORT, isItemChecked(IDC_HTTP_ENABLE) && isItemChecked(IDC_RFB_ENABLE));
-            enableItem(IDC_HTTP_ENABLE, isItemChecked(IDC_RFB_ENABLE));
-
             // RFB port
             enableItem(IDC_PORT, isItemChecked(IDC_RFB_ENABLE));
 
@@ -245,8 +227,6 @@
       bool onOk() {
         regKey.setInt(_T("PortNumber"), isItemChecked(IDC_RFB_ENABLE) ? getItemInt(IDC_PORT) : 0);
         regKey.setInt(_T("IdleTimeout"), getItemInt(IDC_IDLE_TIMEOUT));
-        regKey.setInt(_T("HTTPPortNumber"), isItemChecked(IDC_HTTP_ENABLE) && isItemChecked(IDC_RFB_ENABLE)
-                                            ? getItemInt(IDC_HTTP_PORT) : 0);
         regKey.setInt(_T("LocalHost"), isItemChecked(IDC_LOCALHOST));
         regKey.setString(_T("Hosts"), TCharArray(getHosts()).buf);
         return true;
@@ -258,8 +238,6 @@
           return (strcmp(new_hosts.buf, old_hosts.buf) != 0) ||
               (localHost != isItemChecked(IDC_LOCALHOST)) ||
               (port_number != getItemInt(IDC_PORT)) ||
-              (http_port != getItemInt(IDC_HTTP_PORT)) ||
-              ((http_port!=0) != (isItemChecked(IDC_HTTP_ENABLE)!=0)) ||
               (rfb::Server::idleTimeout != getItemInt(IDC_IDLE_TIMEOUT));
         } catch (rdr::Exception&) {
           return false;
@@ -281,15 +259,6 @@
         }
         return strDup(hosts_str.buf);
       }
-      int rfbPortToHTTP(int rfbPort) {
-        int offset = -100;
-        if (http_port)
-          offset = http_port - port_number;
-        int httpPort = rfbPort + offset;
-        if (httpPort <= 0)
-          httpPort = rfbPort;
-        return httpPort;
-      }
 
     protected:
       RegKey regKey;
diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx
index b56eb37..deba0ff 100644
--- a/win/vncconfig/Legacy.cxx
+++ b/win/vncconfig/Legacy.cxx
@@ -192,10 +192,6 @@
 
       void LegacyPage::LoadUserPrefs(const RegKey& key)
       {
-        if (key.getBool(_T("HTTPConnect"), true))
-          regKey.setInt(_T("HTTPPortNumber"), key.getInt(_T("PortNumber"), 5900)-100);
-        else
-          regKey.setInt(_T("HTTPPortNumber"), 0);
         regKey.setInt(_T("PortNumber"), key.getBool(_T("SocketConnect")) ? key.getInt(_T("PortNumber"), 5900) : 0);
         if (key.getBool(_T("AutoPortSelect"), false)) {
           MsgBox(0, _T("The AutoPortSelect setting is not supported by this release.")
diff --git a/win/vncconfig/resource.h b/win/vncconfig/resource.h
index 16bbc15..7350f5b 100644
--- a/win/vncconfig/resource.h
+++ b/win/vncconfig/resource.h
@@ -52,8 +52,6 @@
 #define IDC_BUILDTIME                   1040
 #define IDC_VERSION                     1041
 #define IDC_COPYRIGHT                   1042
-#define IDC_HTTP_ENABLE                 1043
-#define IDC_HTTP_PORT                   1044
 #define IDC_BL_THRESHOLD                1046
 #define IDC_BL_TIMEOUT                  1047
 #define IDC_AFFECT_SCREENSAVER          1048
diff --git a/win/vncconfig/vncconfig.rc b/win/vncconfig/vncconfig.rc
index 27a8b5d..8d9a6c2 100644
--- a/win/vncconfig/vncconfig.rc
+++ b/win/vncconfig/vncconfig.rc
@@ -110,9 +110,6 @@
     LTEXT           "Disconnect idle clients after (seconds):",IDC_STATIC,7,
                     25,138,15,SS_CENTERIMAGE
     EDITTEXT        IDC_IDLE_TIMEOUT,150,25,61,15,ES_AUTOHSCROLL | ES_NUMBER
-    CONTROL         "Serve Java viewer via HTTP on port:",IDC_HTTP_ENABLE,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,40,138,15
-    EDITTEXT        IDC_HTTP_PORT,150,40,61,15,ES_AUTOHSCROLL | ES_NUMBER
     GROUPBOX        "Access Control",IDC_STATIC,7,55,204,135
     CONTROL         "Only accept connections from the local machine",
                     IDC_LOCALHOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,
diff --git a/win/winvnc/CMakeLists.txt b/win/winvnc/CMakeLists.txt
index ac9ae29..113796c 100644
--- a/win/winvnc/CMakeLists.txt
+++ b/win/winvnc/CMakeLists.txt
@@ -1,29 +1,18 @@
 include_directories(${CMAKE_BINARY_DIR}/win ${CMAKE_CURRENT_SOURCE_DIR})
 
-set(VNCVIEWER_JAR_PATH ${CMAKE_BINARY_DIR}/java/VncViewer.jar)
-set(INDEX_VNC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/index.vnc)
-
-configure_file(winvnc.rc.in winvnc.rc)
-
 add_executable(winvnc4 WIN32
   buildTime.cxx
   ControlPanel.cxx
-  JavaViewer.cxx
   ManagedListener.cxx
   QueryConnectDialog.cxx
   STrayIcon.cxx
   VNCServerService.cxx
   VNCServerWin32.cxx
   winvnc.cxx
-  ${CMAKE_CURRENT_BINARY_DIR}/winvnc.rc)
+  winvnc.rc)
 
 target_link_libraries(winvnc4 rfb rfb_win32 network rdr ws2_32.lib)
 
-if(BUILD_JAVA)
-  set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/winvnc.rc
-    PROPERTIES OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/java/VncViewer.jar)
-endif()
-
 install(TARGETS winvnc4
   RUNTIME DESTINATION ${BIN_DIR}
 )
diff --git a/win/winvnc/JavaViewer.cxx b/win/winvnc/JavaViewer.cxx
deleted file mode 100644
index e2e307e..0000000
--- a/win/winvnc/JavaViewer.cxx
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
- * 
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
- * USA.
- */
-
-#include <winvnc/JavaViewer.h>
-#include <winvnc/VNCServerWin32.h>
-#include <winvnc/resource.h>
-#include <rdr/MemInStream.h>
-#include <rfb/LogWriter.h>
-#include <rfb/VNCServerST.h>
-#include <rfb_win32/TCharArray.h>
-
-#include <windows.h>
-
-using namespace winvnc;
-using namespace rfb;
-
-
-static rfb::LogWriter vlog("JavaViewerServer");
-
-JavaViewerServer::JavaViewerServer(VNCServerWin32* svr) : server(svr) {
-}
-
-JavaViewerServer::~JavaViewerServer() {
-}
-
-rdr::InStream* JavaViewerServer::getFile(const char* name,
-                                         const char** contentType,
-                                         int* contentLength,
-                                         time_t* lastModified)
-{
-  if (strcmp(name, "/") == 0)
-    name = "/index.vnc";
-  if (strcmp(name, "/VncViewer.jar") == 0)
-    name = "VncViewer.jar";
-  if (strcmp(name, "/index.vnc") == 0)
-    name = "index.vnc";
-
-  HRSRC resource = FindResource(0, TStr(name), _T("HTTPFILE"));
-  if (!resource) return 0;
-  HGLOBAL handle = LoadResource(0, resource);
-  if (!handle) return 0;
-  void* buf = LockResource(handle);
-  int len = SizeofResource(0, resource);
-
-  rdr::InStream* is = new rdr::MemInStream(buf, len);
-  if (strlen(name) > 4 && strcasecmp(&name[strlen(name)-4], ".vnc") == 0) {
-    is = new rdr::SubstitutingInStream(is, this, 20);
-    *contentType = "text/html";
-  }
-  return is;
-}
-
-char* JavaViewerServer::substitute(const char* varName)
-{
-  if (strcmp(varName, "$$") == 0) {
-    return rfb::strDup("$");
-  }
-  if (strcmp(varName, "$PORT") == 0) {
-    char* str = new char[10];
-    sprintf(str, "%d", rfbPort);
-    return str;
-  }
-  if (strcmp(varName, "$WIDTH") == 0) {
-    char* str = new char[10];
-    sprintf(str, "%d", server->getDesktopSize().x);
-    return str;
-  }
-  if (strcmp(varName, "$HEIGHT") == 0) {
-    char* str = new char[10];
-    sprintf(str, "%d", server->getDesktopSize().y);
-    return str;
-  }
-  if (strcmp(varName, "$APPLETWIDTH") == 0) {
-    char* str = new char[10];
-    sprintf(str, "%d", server->getDesktopSize().x);
-    return str;
-  }
-  if (strcmp(varName, "$APPLETHEIGHT") == 0) {
-    char* str = new char[10];
-    sprintf(str, "%d", server->getDesktopSize().y);
-    return str;
-  }
-  if (strcmp(varName, "$DESKTOP") == 0) {
-    return rfb::strDup(server->getName());
-  }
-  if (strcmp(varName, "$USER") == 0) {
-    char tempStr[256];  DWORD tempStrLen = 256;
-    GetUserName(tempStr, &tempStrLen);
-    return rfb::strDup(tempStr);
-  }
-  return 0;
-}
diff --git a/win/winvnc/JavaViewer.h b/win/winvnc/JavaViewer.h
deleted file mode 100644
index 79a3969..0000000
--- a/win/winvnc/JavaViewer.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
- * 
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
- * USA.
- */
-
-// -=- JavaViewer.h
-
-// Custom HTTPServer-derived class which serves the Java VNC Viewer
-// to clients, using resource files compiled in to the WinVNC executable.
-
-#ifndef WINVNC_JAVA_VIEWER
-#define WINVNC_JAVA_VIEWER
-
-#include <rfb/HTTPServer.h>
-#include <rdr/SubstitutingInStream.h>
-
-namespace winvnc {
-
-  class VNCServerWin32;
-
-  class JavaViewerServer : public rfb::HTTPServer, public rdr::Substitutor {
-  public:
-    JavaViewerServer(VNCServerWin32* desktop);
-    virtual ~JavaViewerServer();
-
-    virtual rdr::InStream* getFile(const char* name, const char** contentType,
-                                   int* contentLength, time_t* lastModified);
-
-    // rdr::Substitutor callback
-    virtual char* substitute(const char* varName);
-
-    void setRFBport(int port) {
-      rfbPort = port;
-    }
-  protected:
-    int rfbPort;
-    VNCServerWin32* server;
-  };
-
-};
-
-#endif
-
diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx
index b164c65..9f6a954 100644
--- a/win/winvnc/VNCServerWin32.cxx
+++ b/win/winvnc/VNCServerWin32.cxx
@@ -42,8 +42,6 @@
 const TCHAR* winvnc::VNCServerWin32::RegConfigPath = _T("Software\\TigerVNC\\WinVNC4");
 
 
-static IntParameter http_port("HTTPPortNumber",
-  "TCP/IP port on which the server will serve the Java applet VNC Viewer ", 5800);
 static IntParameter port_number("PortNumber",
   "TCP/IP port on which the server will accept connections", 5900);
 static StringParameter hosts("Hosts",
@@ -63,8 +61,7 @@
       CreateEvent(0, FALSE, FALSE, "Global\\SessionEventTigerVNC") : 0),
     vncServer(CStr(ComputerName().buf), &desktop),
     thread_id(-1), runServer(false), isDesktopStarted(false),
-    httpServer(this), config(&sockMgr),
-    rfbSock(&sockMgr), httpSock(&sockMgr), trayIcon(0),
+    config(&sockMgr), rfbSock(&sockMgr), trayIcon(0),
     queryConnectDialog(0)
 {
   commandLock = new os::Mutex;
@@ -148,16 +145,10 @@
   // -=- Make sure we're listening on the right ports.
   rfbSock.setServer(&vncServer);
   rfbSock.setPort(port_number, localHost);
-  httpSock.setServer(&httpServer);
-  httpSock.setPort(http_port, localHost);
-
-  // -=- Update the Java viewer's web page port number.
-  httpServer.setRFBport(rfbSock.isListening() ? port_number : 0);
 
   // -=- Update the TCP address filter for both ports, if open.
   CharArray pattern(hosts.getData());
   rfbSock.setFilter(pattern.buf);
-  httpSock.setFilter(pattern.buf);
 
   // -=- Update the tray icon tooltip text with IP addresses
   processAddressChange();
diff --git a/win/winvnc/VNCServerWin32.h b/win/winvnc/VNCServerWin32.h
index ed051dc..271cb76 100644
--- a/win/winvnc/VNCServerWin32.h
+++ b/win/winvnc/VNCServerWin32.h
@@ -27,7 +27,6 @@
 #include <rfb_win32/SocketManager.h>
 #include <rfb_win32/TCharArray.h>
 #include <winvnc/QueryConnectDialog.h>
-#include <winvnc/JavaViewer.h>
 #include <winvnc/ManagedListener.h>
 
 namespace os {
@@ -78,10 +77,6 @@
 
     bool setClientsStatus(rfb::ListConnInfo* LCInfo);
 
-    // Used by JavaViewerServer
-    const char* getName() {return vncServer.getName();}
-    rfb::Point getDesktopSize() {return desktop.getFbSize();}
-
   protected:
     // VNCServerST::QueryConnectionHandler interface
     // Callback used to prompt user to accept or reject a connection.
@@ -121,12 +116,10 @@
     DWORD thread_id;
     bool runServer;
     bool isDesktopStarted;
-    JavaViewerServer httpServer;
     rfb::win32::SocketManager sockMgr;
     rfb::win32::RegConfig config;
 
     ManagedListener rfbSock;
-    ManagedListener httpSock;
     STrayIconThread* trayIcon;
 
     QueryConnectDialog* queryConnectDialog;
diff --git a/win/winvnc/index.vnc b/win/winvnc/index.vnc
deleted file mode 100644
index 560fa2e..0000000
--- a/win/winvnc/index.vnc
+++ /dev/null
@@ -1,22 +0,0 @@
-<!-- 
-     index.vnc - default HTML page for TigerVNC Java viewer applet, to be
-     used with WinVNC. On any file ending in .vnc, the HTTP server embedded in
-     WinVNC will substitute the following variables when preceded by a dollar:
-     USER, DESKTOP, APPLETWIDTH, APPLETHEIGHT, WIDTH, HEIGHT, PORT,
-     Use two dollar signs ($$) to get a dollar sign in the generated
-     HTML page.
--->
-
-<HTML>
-<TITLE>
-$USER's $DESKTOP desktop
-</TITLE>
-<APPLET CODE=com.tigervnc.vncviewer.VncViewer ARCHIVE=VncViewer.jar
-        WIDTH=$APPLETWIDTH HEIGHT=$APPLETHEIGHT>
-<param name=PORT value=$PORT>
-<param name="Embed" value="true">
-<param name="draggable" value="true">
-</APPLET>
-<BR>
-<A href="http://www.tigervnc.org/">TigerVNC site</A>
-</HTML>
diff --git a/win/winvnc/resource.h b/win/winvnc/resource.h
index 68316be..0e52368 100644
--- a/win/winvnc/resource.h
+++ b/win/winvnc/resource.h
@@ -8,7 +8,6 @@
 #define IDD_DIALOG1                     103
 #define IDD_ABOUT                       104
 #define IDI_CONNECTED                   105
-#define IDR_VNCVIEWER_JAR               106
 #define IDD_QUERY_CONNECT               107
 #define IDD_ADD_NEW_CLIENT              108
 #define IDB_BITMAP                      109
diff --git a/win/winvnc/winvnc.rc.in b/win/winvnc/winvnc.rc
similarity index 96%
rename from win/winvnc/winvnc.rc.in
rename to win/winvnc/winvnc.rc
index 2b50966..44cb71c 100644
--- a/win/winvnc/winvnc.rc.in
+++ b/win/winvnc/winvnc.rc
@@ -217,18 +217,6 @@
 
 /////////////////////////////////////////////////////////////////////////////
 //
-// HTTPFILE
-//
-
-#cmakedefine BUILD_JAVA
-
-#ifdef BUILD_JAVA
-VNCVIEWER.JAR          HTTPFILE DISCARDABLE    "@VNCVIEWER_JAR_PATH@"
-INDEX.VNC              HTTPFILE DISCARDABLE    "@INDEX_VNC_PATH@"
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-//
 // 24
 //