+/* Copyright (c) 2011 Peter Troshin\r
+ * \r
+ * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 \r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under the terms of the\r
+ * Apache License version 2 as published by the Apache Software Foundation\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
+ * License for more details.\r
+ * \r
+ * A copy of the license is in apache_license.txt. It is also available here:\r
+ * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
+ * \r
+ * Any republication or derived work distributed in source code form\r
+ * must include this copyright and license notice.\r
+ */\r
package compbio.stat.servlet;\r
\r
import java.io.IOException;\r
import javax.servlet.http.HttpServletRequest;\r
import javax.servlet.http.HttpServletResponse;\r
\r
+import org.apache.log4j.Logger;\r
+\r
import compbio.stat.servlet.util.StatCollection;\r
import compbio.stat.servlet.util.Totals;\r
\r
public class DisplayStat extends HttpServlet {\r
\r
+ private final static Logger log = Logger.getLogger(DisplayStat.class);\r
+\r
@Override\r
protected void doGet(HttpServletRequest req, HttpServletResponse resp)\r
throws ServletException, IOException {\r
String datetime = req.getParameter("datetime");\r
- System.out.println("? " + datetime);\r
+\r
Date fromDate = new Date(Long.parseLong(datetime));\r
Calendar toCal = GregorianCalendar.getInstance();\r
toCal.setTime(fromDate);\r
StatCollection stats = StatCollection.newStatCollecton(fromDate,\r
toCal.getTime());\r
\r
- System.out.println("stats: " + stats);\r
+ log.trace("Stats: " + stats);\r
req.setAttribute("stat", stats);\r
req.setAttribute("statTotal", Totals.sumStats(stats.getAllStat()));\r
req.setAttribute("statTotalCluster",\r
\r
req.setAttribute("startDate", fromDate);\r
req.setAttribute("stopDate", toCal.getTime());\r
- System.out.println(fromDate + " " + toCal.getTime());\r
+ log.trace("from " + fromDate + " to " + toCal.getTime());\r
RequestDispatcher dispatcher = req\r
.getRequestDispatcher("statpages/Statistics.jsp");\r
dispatcher.forward(req, resp);\r
\r
} catch (SQLException e) {\r
- e.printStackTrace();\r
+ log.error(e.getMessage(), e);\r
throw new ServletException(e);\r
}\r
\r