comparison src/myVncProxy/CreateHtmlFile.java @ 32:015d43bb2b62

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