--- android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java 2011/04/20 21:31:45 1370 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java 2011/05/02 19:28:02 1431 @@ -58,7 +58,7 @@ return fileStr.substring(fileStr.length() - 3).equals(".gz"); } - protected File[] getFiles(int count) { + public static File[] getFiles(int count) { File accessLogDir = new File("/home/app/domain1/logs/access/"); //File accessLogDir = new File("/home/torben/inst/glassfishv3/glassfish/domains/domain1/logs/access/"); @@ -267,8 +267,9 @@ for(RequestPosition current : list) { String id = color + count++; sb.append( " \n" ); + sb.append( " ").append(current.time).append("\n" ); sb.append( " #").append(color).append("\n" ); - sb.append( " Time=").append(current.time).append("]]>\n" ); + sb.append( " ]]>\n" ); sb.append( " ").append(current.lng).append(",").append(current.lat).append(",0\n" ); sb.append( " \n" ); } @@ -403,12 +404,16 @@ byte bytes[] = baos.toByteArray(); resp.setContentType(KMZ); - resp.setContentLength( bytes.length ); + resp.setHeader("Content-Disposition", "attachment; filename=Traininfo-requestplotter.kmz"); + resp.setContentLength( bytes.length ); resp.getOutputStream().write(bytes); } else { - resp.setContentType(KML); - resp.getWriter().print( kmlData ); + byte bytes[] = kmlData.getBytes(); + + resp.setContentType(KML); + resp.setContentLength( bytes.length ); + resp.getOutputStream().write(bytes); } } }