Fix problems with the servlet based codes. The last revision in the branch.
[proteocache.git] / server / compbio / listeners / ServletTimeExecution.java
index c380604..46e1460 100644 (file)
@@ -1,7 +1,9 @@
 package compbio.listeners;
 
 import java.io.IOException;
+import java.text.SimpleDateFormat;
 import java.util.Calendar;
+import java.util.Date;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletException;
@@ -10,7 +12,6 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import compbio.statistic.StatisticsProt;
 import compbio.statistic.CassandraRequester;
 
 /**
@@ -31,7 +32,7 @@ public class ServletTimeExecution extends HttpServlet {
                CassandraRequester sp = new CassandraRequester();
                if (null != request.getParameter("option")) {
                        Calendar cal = Calendar.getInstance();
-                       date1 = StatisticsProt.DateFormatYYMMDD(sp.earliestDate());
+                       date1 = DateFormatYYMMDD(sp.earliestDate());
                        date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH);
                }
                request.setAttribute("data1", date1);
@@ -51,4 +52,12 @@ public class ServletTimeExecution extends HttpServlet {
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                doGet(request, response);
        }
+       /*
+        * convert ???
+        */
+       private String DateFormatYYMMDD(long indate) {
+               SimpleDateFormat datformat = new SimpleDateFormat("yyyy/MM/dd");
+               String dateString = datformat.format(new Date(indate));
+               return dateString;
+       }
 }