1.1 --- a/launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java Sat Jan 12 16:29:29 2013 +0100
1.2 +++ b/launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java Sat Jan 12 17:35:01 2013 +0100
1.3 @@ -237,20 +237,14 @@
1.4
1.5 URI uri = new URI("http://localhost:" + port + page);
1.6 LOG.log(Level.INFO, "Showing {0}", uri);
1.7 -// try {
1.8 -// Desktop.getDesktop().browse(uri);
1.9 -// return null;
1.10 -// } catch (UnsupportedOperationException ex)
1.11 - {
1.12 -// File dir = File.createTempFile("chrome", ".dir");
1.13 -// dir.delete();
1.14 -// dir.mkdirs();
1.15 -// String[] cmd = {
1.16 -// "google-chrome", "--user-data-dir=" + dir, "--app=" + uri.toString()
1.17 -// };
1.18 -// LOG.log(Level.INFO, "Launching {0}", Arrays.toString(cmd));
1.19 -// final Process process = Runtime.getRuntime().exec(cmd);
1.20 -// return new Object[] { process, dir };
1.21 + if (cmd == null) {
1.22 + try {
1.23 + java.awt.Desktop.getDesktop().browse(uri);
1.24 + LOG.log(Level.INFO, "Desktop.browse successfully finished");
1.25 + return null;
1.26 + } catch (UnsupportedOperationException ex) {
1.27 + LOG.log(Level.INFO, "Desktop.browse not supported", ex);
1.28 + }
1.29 }
1.30 {
1.31 String cmdName = cmd == null ? "xdg-open" : cmd;
1.32 @@ -365,8 +359,13 @@
1.33 r = r.substring(1);
1.34 }
1.35 }
1.36 - if (r.endsWith(".html") || r.endsWith(".xhtml")) {
1.37 + if (r.endsWith(".html")) {
1.38 response.setContentType("text/html");
1.39 + LOG.info("Content type text/html");
1.40 + }
1.41 + if (r.endsWith(".xhtml")) {
1.42 + response.setContentType("application/xhtml+xml");
1.43 + LOG.info("Content type application/xhtml+xml");
1.44 }
1.45 OutputStream os = response.getOutputStream();
1.46 try (InputStream is = res.get(r)) {