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

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

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

revision 1020 by torben, Sat Jul 10 10:53:44 2010 UTC revision 1021 by torben, Mon Aug 30 13:59:54 2010 UTC
# Line 66  public class DepartureServlet extends Ht Line 66  public class DepartureServlet extends Ht
66                  int station = Integer.parseInt( req.getParameter("station") );                  int station = Integer.parseInt( req.getParameter("station") );
67                  String format = req.getParameter("format");                  String format = req.getParameter("format");
68    
69                  DepartureBean beans;                  DepartureBean beans;            
   
                 String stationName = StationDAO.getStationName(station);  
70    
71                  try {                  try {
72                          beans = fetcher.cachedLookupDepartures(station, arrival);                          beans = fetcher.cachedLookupDepartures(station, arrival);
# Line 94  public class DepartureServlet extends Ht Line 92  public class DepartureServlet extends Ht
92                                    
93                  if (format.equalsIgnoreCase("xml")) {                  if (format.equalsIgnoreCase("xml")) {
94                          resp.setContentType("text/xml");                          resp.setContentType("text/xml");
95                          resp.getWriter().print( formatXml(beans, stationName, arrival) );                          resp.getWriter().print( formatXml(beans, arrival) );
96                  } else if (format.equalsIgnoreCase("html")) {                  } else if (format.equalsIgnoreCase("html")) {
97                                                    
98                          String advStr = req.getParameter("advanced");                          String advStr = req.getParameter("advanced");
99                          boolean advanced = advStr != null ? Boolean.parseBoolean(advStr) : false;                          boolean advanced = advStr != null ? Boolean.parseBoolean(advStr) : false;
100                                                    
101                          req.setAttribute("advanced", advanced);                          req.setAttribute("advanced", advanced);
                         req.setAttribute("stationname", stationName );  
102                          req.setAttribute("departurebeans", beans);                          req.setAttribute("departurebeans", beans);
103                          req.setAttribute("stationID", station );                          req.setAttribute("stationID", station );
104                          getServletContext().getRequestDispatcher("/ViewDepartures.jsp").forward(req,resp);                          getServletContext().getRequestDispatcher("/ViewDepartures.jsp").forward(req,resp);
# Line 111  public class DepartureServlet extends Ht Line 108  public class DepartureServlet extends Ht
108    
109          }          }
110    
111          protected String formatXml(DepartureBean beans, String stationName, boolean arrival) throws ServletException{          protected String formatXml(DepartureBean beans, boolean arrival) throws ServletException{
112                  String xml = "";                  String xml = "";
113                  try {                  try {
114                          DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();                          DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
# Line 120  public class DepartureServlet extends Ht Line 117  public class DepartureServlet extends Ht
117                                                    
118                          Document doc = impl.createDocument(null,null,null);                          Document doc = impl.createDocument(null,null,null);
119                  Element root = doc.createElement("departureinfo");                  Element root = doc.createElement("departureinfo");
120                  root.setAttribute("station", stationName);                  root.setAttribute("station", beans.getStationName());
121                  root.setAttribute("arrival", Boolean.toString(arrival) );                  root.setAttribute("arrival", Boolean.toString(arrival) );
122                                    
123                  for (String notif : beans.notifications) {                  for (String notif : beans.notifications) {

Legend:
Removed from v.1020  
changed lines
  Added in v.1021

  ViewVC Help
Powered by ViewVC 1.1.20