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

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

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

revision 588 by torben, Mon Feb 8 19:12:15 2010 UTC revision 958 by torben, Mon Jul 5 09:48:06 2010 UTC
# Line 7  import java.util.logging.Level; Line 7  import java.util.logging.Level;
7  import java.util.logging.Logger;  import java.util.logging.Logger;
8    
9  import javax.servlet.ServletException;  import javax.servlet.ServletException;
10    import javax.servlet.annotation.WebServlet;
11  import javax.servlet.http.HttpServlet;  import javax.servlet.http.HttpServlet;
12  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletRequest;
13  import javax.servlet.http.HttpServletResponse;  import javax.servlet.http.HttpServletResponse;
# Line 14  import javax.servlet.http.HttpServletRes Line 15  import javax.servlet.http.HttpServletRes
15  /**  /**
16   * Servlet implementation class LocateStations   * Servlet implementation class LocateStations
17   */   */
18    @WebServlet(urlPatterns={"/LocateStations"})
19  public class LocateStations extends HttpServlet {  public class LocateStations extends HttpServlet {
20          private static final long serialVersionUID = 1L;          private static final long serialVersionUID = 1L;
21    
# Line 41  public class LocateStations extends Http Line 43  public class LocateStations extends Http
43          protected List<StationBean> getStations(HttpServletRequest req) throws SQLException {          protected List<StationBean> getStations(HttpServletRequest req) throws SQLException {
44                  List<StationBean> stations = null;                  List<StationBean> stations = null;
45                  if (req.getParameter("latitude") != null && req.getParameter("latitude") != null) {                  if (req.getParameter("latitude") != null && req.getParameter("latitude") != null) {
46                            
47                            Statistics.getInstance().incrementStationLookupsLocation();
48                            
49                          double latitude = Double.parseDouble( req.getParameter("latitude") );                          double latitude = Double.parseDouble( req.getParameter("latitude") );
50                          double longitude = Double.parseDouble( req.getParameter("longitude") );                          double longitude = Double.parseDouble( req.getParameter("longitude") );
51                          stations = stationDao.getByLocation(latitude, longitude);                          stations = stationDao.getByLocation(latitude, longitude);
52    
53                  } else if (req.getParameter("name") != null) {                  } else if (req.getParameter("name") != null) {
54                            Statistics.getInstance().incrementStationLookupsName();
55                          String name = req.getParameter("name").trim();                          String name = req.getParameter("name").trim();
56                          stations = stationDao.getByName(name);                          stations = stationDao.getByName(name);
57    
58                  } else if (req.getParameter("list") != null) {                  } else if (req.getParameter("list") != null) {
59                            Statistics.getInstance().incrementStationLookupsFavorites();
60                          String list = transformToIntList( req.getParameter("list"));                          String list = transformToIntList( req.getParameter("list"));
61                          stations = stationDao.getByList(list);                          stations = stationDao.getByList(list);
62                  }                  }
# Line 61  public class LocateStations extends Http Line 68  public class LocateStations extends Http
68    
69                  StringBuffer buff = new StringBuffer();                  StringBuffer buff = new StringBuffer();
70    
71                  buff.append("<?xml version=\"1.0\" ?>\n");                  //buff.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
72                  buff.append("<stations>\n");                      buff.append("<stations>\n");    
73    
74    

Legend:
Removed from v.588  
changed lines
  Added in v.958

  ViewVC Help
Powered by ViewVC 1.1.20