/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 802 by torben, Mon Jun 7 11:46:25 2010 UTC revision 803 by torben, Mon Jun 7 12:01:42 2010 UTC
# Line 159  public class RequestPlotter extends Http Line 159  public class RequestPlotter extends Http
159    
160          @Override          @Override
161          protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {          protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
162                    final String KEY = "kmldata";
163                                    
164                  String data = cache.get("data");                  String kmlData = cache.get(KEY);
165                                    
166                  if (data == null) {                  if (kmlData == null) {
167                          data = formatXml( getRequestsFromFile() );                          kmlData = formatXml( getRequestsFromFile() );
168                          cache.put("data", data);                          cache.put(KEY, kmlData);
169                          data += "<!-- from source -->";                                          kmlData += "<!-- from source -->";                      
170                  } else {                  } else {
171                          data += "<!-- cached -->";                          kmlData += "<!-- cached -->";
172                  }                  }
173    
174                                    
# Line 178  public class RequestPlotter extends Http Line 179  public class RequestPlotter extends Http
179    
180                          ZipOutputStream zip = new ZipOutputStream(baos);                          ZipOutputStream zip = new ZipOutputStream(baos);
181                          zip.putNextEntry( new ZipEntry("trains.kml") );                          zip.putNextEntry( new ZipEntry("trains.kml") );
182                          zip.write( data.getBytes() );                          zip.write( kmlData.getBytes() );
183                          zip.closeEntry();                          zip.closeEntry();
184                          zip.close();                          zip.close();
185    
# Line 190  public class RequestPlotter extends Http Line 191  public class RequestPlotter extends Http
191    
192                  } else {                  } else {
193                          resp.setContentType(KML);                          resp.setContentType(KML);
194                          resp.getWriter().print( data );                          resp.getWriter().print( kmlData );
195                  }                  }
196          }          }
197  }  }

Legend:
Removed from v.802  
changed lines
  Added in v.803

  ViewVC Help
Powered by ViewVC 1.1.20