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

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/TimetableFetcher.java

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

revision 581 by torben, Tue Feb 2 18:47:55 2010 UTC revision 591 by torben, Wed Feb 10 14:07:04 2010 UTC
# Line 8  import java.util.List; Line 8  import java.util.List;
8  import java.util.Map;  import java.util.Map;
9  import java.util.logging.Logger;  import java.util.logging.Logger;
10    
11    import com.gargoylesoftware.htmlunit.BrowserVersion;
12  import com.gargoylesoftware.htmlunit.Page;  import com.gargoylesoftware.htmlunit.Page;
13  import com.gargoylesoftware.htmlunit.RefreshHandler;  import com.gargoylesoftware.htmlunit.RefreshHandler;
14  import com.gargoylesoftware.htmlunit.WebClient;  import com.gargoylesoftware.htmlunit.WebClient;
# Line 26  public class TimetableFetcher { Line 27  public class TimetableFetcher {
27                                    
28          }          }
29                                    
30          Map<String, List<TimetableBean>> cache = new TimeoutMap<String,List<TimetableBean>>(120 * 1000);          Map<String, List<TimetableBean>> cache;
31                    
32                    
33          Logger logger = Logger.getLogger(TimetableFetcher.class.getName());          Logger logger = Logger.getLogger(TimetableFetcher.class.getName());
34                    
35          private boolean useTempSite;          private boolean useTempSite;
36                    
37          public TimetableFetcher(boolean tmpSite) {          public TimetableFetcher(boolean tmpSite, int cacheTimeout) {
38                  useTempSite = tmpSite;                  useTempSite = tmpSite;
39                    
40                    cache = new TimeoutMap<String,List<TimetableBean>>(cacheTimeout);
41          }          }
42                    
43                    
# Line 65  public class TimetableFetcher { Line 68  public class TimetableFetcher {
68                  String url = "http://www.bane.dk/visRute.asp?W=" + type + "&TogNr=" + trainID + "&artikelId=4276";                  String url = "http://www.bane.dk/visRute.asp?W=" + type + "&TogNr=" + trainID + "&artikelId=4276";
69                                                                    
70    
71              final WebClient webClient = new WebClient();              final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3);
72              webClient.setTimeout(2500);              webClient.setTimeout(2500);
73              webClient.setJavaScriptEnabled(false);                      webClient.setJavaScriptEnabled(false);        
74              webClient.setRefreshHandler( new NullRefreshHandler() );              webClient.setRefreshHandler( new NullRefreshHandler() );
# Line 116  public class TimetableFetcher { Line 119  public class TimetableFetcher {
119              } else {              } else {
120                  logger.warning("No time table found, trainID=" + trainID + " type=" + type);                  logger.warning("No time table found, trainID=" + trainID + " type=" + type);
121              }              }
122                webClient.closeAllWindows();
123                                    
124                  return timetableList;                  return timetableList;
125          }          }

Legend:
Removed from v.581  
changed lines
  Added in v.591

  ViewVC Help
Powered by ViewVC 1.1.20