Add Java Web Start for Java HVM console
authorAdam Glasgall <glasgall@mit.edu>
Fri, 15 Jun 2018 00:14:42 +0000 (20:14 -0400)
committerAdam Glasgall <glasgall@mit.edu>
Fri, 15 Jun 2018 00:16:49 +0000 (20:16 -0400)
Add Java Web Start support for Java HVM console as a stopgap until we
have a proper JavaScript one, since browsers by and large don't have a
Java plugin anymore.

code/main.py
code/templates/vnc.mako
code/templates/vnc_jnlp.mako [new file with mode: 0644]
debian/changelog

index 6587484..59a31f8 100755 (executable)
@@ -319,8 +319,20 @@ console will suffer artifacts.
 
         @cherrypy.expose
         @cherrypy.tools.mako(filename="/vnc.mako")
+
         def vnc(self, machine_id):
-            """VNC applet page.
+            """VNC applet page"""
+            return self._vnc(machine_id)
+
+        @cherrypy.expose
+        @cherrypy.tools.response_headers(headers=[('Content-Disposition', 'attachment; filename=vnc.jnlp')])
+        @cherrypy.tools.mako(filename="/vnc_jnlp.mako", content_type="application/x-java-jnlp-file")
+        def vnc_jnlp(self, machine_id):
+            """VNC applet exposed as a Java Web Start app (JNLP file)"""
+            return self._vnc(machine_id)
+
+        def _vnc(self, machine_id):
+            """VNC applet page functionality.
 
             Note that due to same-domain restrictions, the applet connects to
             the webserver, which needs to forward those requests to the xen
index 9e39294..b7b6857 100644 (file)
@@ -20,5 +20,5 @@ Console to ${machine.name}
 <param name="VMNAME" value="${machine.name}">
 <param name="AUTHTOKEN" value="${authtoken}">
 <param name="SocketFactory" value="VNCProxyConnectSocketFactory">
-You must have Java enabled in your browser to use the VNC console.
+You must have Java enabled in your browser to use the VNC console applet. If your browser does not support Java, but you do have a Java Runtime Environment installed, try clicking <a href="machine/${machine.machine_id}/vnc_jnlp">here</a> to launch the VNC console via Java Web Start.
 </applet>
diff --git a/code/templates/vnc_jnlp.mako b/code/templates/vnc_jnlp.mako
new file mode 100644 (file)
index 0000000..60f3269
--- /dev/null
@@ -0,0 +1,24 @@
+<jnlp spec="1.0+" codebase="https://xvm.mit.edu:446/static/">
+  <information>
+    <title>XVM Java Console</title>
+    <vendor>Invirt Project</vendor>
+    <description>Java Web Start Application</description>
+  </information>
+
+  <security>
+   <all-permissions/>
+  </security>
+
+  <resources>
+    <property name="jnlp.packEnabled" value="true"/>
+    <j2se version="1.6.0+" initial-heap-size="32M" max-heap-size="128M"/>
+    <jar href="VncViewer.jar" download="eager" main="true"/>
+  </resources>
+  <applet-desc main-class="VncViewer" name="VncViewer" width="1000" height="1000">
+    <param name="PORT" value="${port}" />
+    <param name="HOST" value="${hostname}" />
+    <param name="VMNAME" value="${machine.name}" />
+    <param name="AUTHTOKEN" value="${authtoken}" />
+    <param name="SocketFactory" value="VNCProxyConnectSocketFactory" />
+  </applet-desc>
+</jnlp>
index 4dba5bd..58385e6 100644 (file)
@@ -1,3 +1,11 @@
+invirt-web (0.1.53~glasgall1) precise; urgency=medium
+
+  * Add Java Web Start support for Java HVM console as a stopgap until we
+    have a proper JavaScript one, since browsers by and large don't have a
+    Java plugin anymore.
+
+ -- Adam Glasgall <glasgall@mit.edu>  Thu, 14 Jun 2018 20:11:44 -0400
+
 invirt-web (0.1.52) unstable; urgency=low
 
   * preseeds: Correct country string error; fixes mirror selection