41 |
protected List<StationBean> getStations(HttpServletRequest req) throws SQLException { |
protected List<StationBean> getStations(HttpServletRequest req) throws SQLException { |
42 |
List<StationBean> stations = null; |
List<StationBean> stations = null; |
43 |
if (req.getParameter("latitude") != null && req.getParameter("latitude") != null) { |
if (req.getParameter("latitude") != null && req.getParameter("latitude") != null) { |
44 |
|
|
45 |
|
Statistics.getInstance().incrementStationLookupsLocation(); |
46 |
|
|
47 |
double latitude = Double.parseDouble( req.getParameter("latitude") ); |
double latitude = Double.parseDouble( req.getParameter("latitude") ); |
48 |
double longitude = Double.parseDouble( req.getParameter("longitude") ); |
double longitude = Double.parseDouble( req.getParameter("longitude") ); |
49 |
stations = stationDao.getByLocation(latitude, longitude); |
stations = stationDao.getByLocation(latitude, longitude); |
50 |
|
|
51 |
} else if (req.getParameter("name") != null) { |
} else if (req.getParameter("name") != null) { |
52 |
|
Statistics.getInstance().incrementStationLookupsName(); |
53 |
String name = req.getParameter("name").trim(); |
String name = req.getParameter("name").trim(); |
54 |
stations = stationDao.getByName(name); |
stations = stationDao.getByName(name); |
55 |
|
|
56 |
} else if (req.getParameter("list") != null) { |
} else if (req.getParameter("list") != null) { |
57 |
|
Statistics.getInstance().incrementStationLookupsFavorites(); |
58 |
String list = transformToIntList( req.getParameter("list")); |
String list = transformToIntList( req.getParameter("list")); |
59 |
stations = stationDao.getByList(list); |
stations = stationDao.getByList(list); |
60 |
} |
} |
66 |
|
|
67 |
StringBuffer buff = new StringBuffer(); |
StringBuffer buff = new StringBuffer(); |
68 |
|
|
69 |
buff.append("<?xml version=\"1.0\" ?>\n"); |
buff.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); |
70 |
buff.append("<stations>\n"); |
buff.append("<stations>\n"); |
71 |
|
|
72 |
|
|