32
|
1 package myVncProxy;
|
|
2
|
|
3 import java.io.BufferedWriter;
|
|
4 import java.io.File;
|
|
5 import java.io.FileWriter;
|
|
6 import java.io.PrintWriter;
|
33
|
7 import java.net.InetAddress;
|
32
|
8
|
|
9 public class CreateHtmlFile {
|
|
10
|
|
11 String header="<HTML><TITLE>hbpVNC desktop</TITLE>\n";
|
34
|
12 String footer="</APPLET>\n<BR>\n<A href=\"http://ie.u-ryukyu.ac.jp/\">University of the Ryukyu </A>\n</HTML>\n";
|
32
|
13
|
|
14 String host;
|
|
15 String user;
|
|
16 int port;
|
|
17 int width;
|
|
18 int height;
|
|
19
|
|
20 File file;
|
|
21
|
|
22 MyRfbProto rfb;
|
|
23
|
|
24 CreateHtmlFile(MyRfbProto _rfb, String _host, String _user){
|
|
25 rfb = _rfb;
|
|
26 host = _host;
|
|
27 user = _user;
|
|
28 port = rfb.getAcceptPort();
|
|
29 width = rfb.framebufferWidth;
|
|
30 height = rfb.framebufferHeight;
|
|
31
|
|
32 }
|
|
33
|
|
34 void createHtml(){
|
|
35 try{
|
36
|
36 // String html_file = "/var/www/html/hbpVNC/view/"+ user +".html";
|
32
|
37 String html_file = "./"+ user +".html";
|
|
38 file = new File(html_file);
|
|
39 PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
|
|
40
|
33
|
41 InetAddress addr = InetAddress.getLocalHost();
|
|
42
|
35
|
43 String contents = "<APPLET CODE=\"VncViewer.class\" ARCHIVE=\"VncViewer.jar\"\n " +
|
32
|
44 "WIDTH=\""+width+"\" HEIGHT=\""+height+"\">\n";
|
|
45 contents = contents+"<PARAM NAME=\"PORT\" VALUE=\""+port+"\">\n";
|
33
|
46 contents = contents+"<PARAM NAME=\"HOST\" VALUE=\""+addr.getHostAddress()+"\">\n";
|
32
|
47
|
|
48 pw.println(header+contents+footer);
|
|
49 pw.close();
|
|
50 }
|
|
51 catch (Exception e) {
|
|
52 e.printStackTrace();
|
|
53 }
|
|
54 }
|
|
55
|
|
56
|
|
57 }
|