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

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

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

revision 584 by torben, Fri Feb 5 13:57:39 2010 UTC revision 711 by torben, Wed May 5 20:11:03 2010 UTC
# Line 11  import javax.servlet.http.HttpServletReq Line 11  import javax.servlet.http.HttpServletReq
11  import javax.servlet.http.HttpServletResponse;  import javax.servlet.http.HttpServletResponse;
12    
13  import dk.thoerup.circuitbreaker.CircuitBreakerException;  import dk.thoerup.circuitbreaker.CircuitBreakerException;
14    import dk.thoerup.traininfoservice.Statistics;
15    
16  /**  /**
17   * Servlet implementation class TimetableServlet   * Servlet implementation class TimetableServlet
# Line 39  public class TimetableServlet extends Ht Line 40  public class TimetableServlet extends Ht
40                          response.sendError(400, "not enough parameters");                          response.sendError(400, "not enough parameters");
41                          return;                          return;
42                  }                  }
43                    Statistics.getInstance().incrementTimetableLookups();
44                                    
45                  String train = request.getParameter("train").trim();                  String train = request.getParameter("train").trim();
46                    String trainID;
47                    String type = request.getParameter("type");
48                                    
49                  String sections[] = train.split(" ");                  if (type != null) {
50                  if (sections.length != 2) {                           trainID = train;
51                          response.sendError(400, "Invalid parameter");                  } else { //remove this failover sometime after release of client 0.6.4
52                          return;                          String sections[] = train.split(" ");
53                            if (sections.length != 2) {
54                                    response.sendError(400, "Invalid parameter");
55                                    return;
56                            }
57                                    
58                            type = lookupType(sections[0]);
59                            trainID = sections[1];
60                  }                  }
61                                            
                 String type = lookupType(sections[0]);  
                 String trainID = sections[1];  
62                  try                  try
63                  {                  {
64                          List<TimetableBean> timetable = fetcher.cachedLookupTimetable(trainID, type);                          List<TimetableBean> timetable = fetcher.cachedLookupTimetable(trainID, type);
# Line 70  public class TimetableServlet extends Ht Line 79  public class TimetableServlet extends Ht
79                  }                  }
80                                    
81          }          }
82                    /*remove /outcomment/deprecate after 0.6.4 release */
83          String lookupType(String trainCode) {          String lookupType(String trainCode) {
84                  trainCode = trainCode.toLowerCase();                  trainCode = trainCode.toLowerCase();
85                                    

Legend:
Removed from v.584  
changed lines
  Added in v.711

  ViewVC Help
Powered by ViewVC 1.1.20