/[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 800 by torben, Mon Jun 7 10:02:26 2010 UTC revision 802 by torben, Mon Jun 7 11:46:25 2010 UTC
# Line 10  import java.text.SimpleDateFormat; Line 10  import java.text.SimpleDateFormat;
10  import java.util.ArrayList;  import java.util.ArrayList;
11  import java.util.Date;  import java.util.Date;
12  import java.util.List;  import java.util.List;
13    import java.util.Map;
14  import java.util.logging.Level;  import java.util.logging.Level;
15  import java.util.logging.Logger;  import java.util.logging.Logger;
16  import java.util.zip.ZipEntry;  import java.util.zip.ZipEntry;
# Line 20  import javax.servlet.http.HttpServlet; Line 21  import javax.servlet.http.HttpServlet;
21  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletRequest;
22  import javax.servlet.http.HttpServletResponse;  import javax.servlet.http.HttpServletResponse;
23    
24    import dk.thoerup.traininfoservice.banedk.TimeoutMap;
25    
26  public class RequestPlotter extends HttpServlet {  public class RequestPlotter extends HttpServlet {
27          private static final long serialVersionUID = 1L;          private static final long serialVersionUID = 1L;
28    
# Line 27  public class RequestPlotter extends Http Line 30  public class RequestPlotter extends Http
30    
31          static final String KML = "application/vnd.google-earth.kml";          static final String KML = "application/vnd.google-earth.kml";
32          static final String KMZ = "application/vnd.google-earth.kmz";          static final String KMZ = "application/vnd.google-earth.kmz";
33            
34            Map<String,String> cache = new TimeoutMap<String,String>(2*60*1000);
35    
36          class RequestPosition {          class RequestPosition {
37                  public String ip;                  public String ip;
# Line 100  public class RequestPlotter extends Http Line 105  public class RequestPlotter extends Http
105    
106                  sb.append( " <Style id=\"green\">\n" );                  sb.append( " <Style id=\"green\">\n" );
107                  sb.append( "  <IconStyle><Icon><href>http://maps.google.com/mapfiles/kml/paddle/grn-circle.png</href></Icon></IconStyle>\n" );                  sb.append( "  <IconStyle><Icon><href>http://maps.google.com/mapfiles/kml/paddle/grn-circle.png</href></Icon></IconStyle>\n" );
108                  sb.append( " </Style>\n\n" );                            sb.append( " </Style>\n\n" );
109                    
110    /*
111                    String overlay =
112                  " <ScreenOverlay>" +
113                    " <name>Absolute Positioning: Top left</name>" +
114                    " <description>Absolute Positioning: Top left</description>" +
115                    " <visibility>1</visibility>" +
116                    "  <Icon>" +
117                    "   <href>http://code.google.com/apis/kml/documentation/top_left.jpg</href>" +
118                    "  </Icon>" +
119                    "  <overlayXY x=\"0\" y=\"1\" xunits=\"fraction\" yunits=\"fraction\"/>" +
120                    "  <screenXY x=\"0\" y=\"1\" xunits=\"fraction\" yunits=\"fraction\"/>" +
121                    "  <rotationXY x=\"0\" y=\"0\" xunits=\"fraction\" yunits=\"fraction\"/>" +
122                    "  <size x=\"0\" y=\"0\" xunits=\"fraction\" yunits=\"fraction\"/>" +
123                  " </ScreenOverlay>" ;
124                    
125                    sb.append(overlay);
126            */      
127                    
128    
129    
130    
131    
# Line 134  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                    
163                    String data = cache.get("data");
164                    
165                    if (data == null) {
166                            data = formatXml( getRequestsFromFile() );
167                            cache.put("data", data);
168                            data += "<!-- from source -->";                
169                    } else {
170                            data += "<!-- cached -->";
171                    }
172    
173                  String data = formatXml( getRequestsFromFile() );                  
174    
175                  if (req.getParameter("zip") != null) {                  if (req.getParameter("zip") != null) {
176    

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

  ViewVC Help
Powered by ViewVC 1.1.20