comparison src/myVncProxy/CreateHtmlFile.java @ 33:e44ffe36c514

update CreteHostFile
author e085711
date Wed, 27 Apr 2011 06:12:13 +0900
parents 015d43bb2b62
children 8d8e63b3bd83
comparison
equal deleted inserted replaced
32:015d43bb2b62 33:e44ffe36c514
2 2
3 import java.io.BufferedWriter; 3 import java.io.BufferedWriter;
4 import java.io.File; 4 import java.io.File;
5 import java.io.FileWriter; 5 import java.io.FileWriter;
6 import java.io.PrintWriter; 6 import java.io.PrintWriter;
7 import java.net.InetAddress;
7 8
8 public class CreateHtmlFile { 9 public class CreateHtmlFile {
9 10
10 String header="<HTML><TITLE>hbpVNC desktop</TITLE>\n"; 11 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 String footer="<BR><A href=\"http://ie.u-ryukyu.ac.jp\"University of the Ryukyu </HTML>\n";
35 // String html_file = "/var/www/html/hbpVNC/"+ user +".html"; 36 // String html_file = "/var/www/html/hbpVNC/"+ user +".html";
36 String html_file = "./"+ user +".html"; 37 String html_file = "./"+ user +".html";
37 file = new File(html_file); 38 file = new File(html_file);
38 PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file))); 39 PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
39 40
41 InetAddress addr = InetAddress.getLocalHost();
42
40 String contents = "<APPLET CODE=\"VncViwer.class\" ARCHIVE=\"VncViewer.jar\"\n " + 43 String contents = "<APPLET CODE=\"VncViwer.class\" ARCHIVE=\"VncViewer.jar\"\n " +
41 "WIDTH=\""+width+"\" HEIGHT=\""+height+"\">\n"; 44 "WIDTH=\""+width+"\" HEIGHT=\""+height+"\">\n";
42 contents = contents+"<PARAM NAME=\"PORT\" VALUE=\""+port+"\">\n"; 45 contents = contents+"<PARAM NAME=\"PORT\" VALUE=\""+port+"\">\n";
43 contents = contents+"<PARAM NAME=\"HOST\" VALUE=\""+host+"\">\n"; 46 contents = contents+"<PARAM NAME=\"HOST\" VALUE=\""+addr.getHostAddress()+"\">\n";
44 47
45 pw.println(header+contents+footer); 48 pw.println(header+contents+footer);
46 pw.close(); 49 pw.close();
47 } 50 }
48 catch (Exception e) { 51 catch (Exception e) {