--- android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/TimetableServlet.java 2010/02/05 13:57:39 584 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/TimetableServlet.java 2010/05/05 20:11:03 711 @@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse; import dk.thoerup.circuitbreaker.CircuitBreakerException; +import dk.thoerup.traininfoservice.Statistics; /** * Servlet implementation class TimetableServlet @@ -39,17 +40,25 @@ response.sendError(400, "not enough parameters"); return; } + Statistics.getInstance().incrementTimetableLookups(); String train = request.getParameter("train").trim(); + String trainID; + String type = request.getParameter("type"); - String sections[] = train.split(" "); - if (sections.length != 2) { - response.sendError(400, "Invalid parameter"); - return; + if (type != null) { + trainID = train; + } else { //remove this failover sometime after release of client 0.6.4 + String sections[] = train.split(" "); + if (sections.length != 2) { + response.sendError(400, "Invalid parameter"); + return; + } + + type = lookupType(sections[0]); + trainID = sections[1]; } - - String type = lookupType(sections[0]); - String trainID = sections[1]; + try { List timetable = fetcher.cachedLookupTimetable(trainID, type); @@ -70,7 +79,7 @@ } } - + /*remove /outcomment/deprecate after 0.6.4 release */ String lookupType(String trainCode) { trainCode = trainCode.toLowerCase();