/[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 1191 by torben, Fri Nov 12 18:38:30 2010 UTC revision 1248 by torben, Thu Mar 31 17:13:19 2011 UTC
# Line 26  import dk.thoerup.android.traininfo.comm Line 26  import dk.thoerup.android.traininfo.comm
26  import dk.thoerup.circuitbreaker.CircuitBreakerException;  import dk.thoerup.circuitbreaker.CircuitBreakerException;
27  import dk.thoerup.traininfoservice.StationDAO;  import dk.thoerup.traininfoservice.StationDAO;
28  import dk.thoerup.traininfoservice.Statistics;  import dk.thoerup.traininfoservice.Statistics;
29    import dk.thoerup.traininfoservice.banedk.DepartureFetcher.FetchTrainType;
30    
31  /**  /**
32   * Servlet implementation class DepartureServlet   * Servlet implementation class DepartureServlet
# Line 87  public class DepartureServlet extends Ht Line 88  public class DepartureServlet extends Ht
88                  int station = Integer.parseInt( req.getParameter("station") );                  int station = Integer.parseInt( req.getParameter("station") );
89                  String format = req.getParameter("format");                  String format = req.getParameter("format");
90    
91                  DepartureBean beans;                              DepartureBean beans;
92                    
93                    DepartureFetcher.FetchTrainType type = FetchTrainType.BOTH;
94                    if ( req.getParameter("type") != null) {
95                            type = FetchTrainType.valueOf( req.getParameter("type") );
96                    }
97    
98                  try {                  try {
99                          beans = fetcher.cachedLookupDepartures(station, arrival);                          beans = fetcher.cachedLookupDepartures(station, arrival, type);
100                          beans.arrival = arrival;                          beans.arrival = arrival;
101                  } catch (java.io.IOException ioe) {                  } catch (java.io.IOException ioe) {
102                          logger.warning("Read failed, station="+station + ". " + ioe.getMessage() );                          logger.warning("Read failed, station="+station + ". " + ioe.getMessage() );
# Line 121  public class DepartureServlet extends Ht Line 127  public class DepartureServlet extends Ht
127                          resp.setContentType("text/xml");                          resp.setContentType("text/xml");
128                          resp.getWriter().print( formatXml(beans) );                          resp.getWriter().print( formatXml(beans) );
129                  } else if (format.equalsIgnoreCase("html")) {                  } else if (format.equalsIgnoreCase("html")) {
130                          /*                          
131                          String advStr = req.getParameter("advanced");                          String advStr = req.getParameter("advanced");
132                          boolean advanced = advStr != null ? Boolean.parseBoolean(advStr) : false;                          boolean advanced = advStr != null ? Boolean.parseBoolean(advStr) : false;
133                                                    
134                          req.setAttribute("advanced", advanced);                          req.setAttribute("advanced", advanced);
135                          req.setAttribute("departurebeans", beans);                          req.setAttribute("departurebeans", beans);
136                          req.setAttribute("stationID", station );                          req.setAttribute("stationID", station );
137                          getServletContext().getRequestDispatcher("/ViewDepartures.jsp").forward(req,resp);*/                          getServletContext().getRequestDispatcher("/ViewDepartures.jsp").forward(req,resp);
138                          resp.setContentType("text/html");                          /*resp.setContentType("text/html");
139                          resp.getWriter().print(  xmlToHtml(formatXml(beans))  );                          resp.getWriter().print(  xmlToHtml(formatXml(beans))  );*/
140                  } else {                  } else {
141                          resp.sendError(400, "Unknown format");                                            resp.sendError(400, "Unknown format");                  
142                  }                  }

Legend:
Removed from v.1191  
changed lines
  Added in v.1248

  ViewVC Help
Powered by ViewVC 1.1.20