1 package compbio.listeners;
3 import java.io.IOException;
5 import javax.servlet.RequestDispatcher;
6 import javax.servlet.ServletException;
7 import javax.servlet.annotation.WebServlet;
8 import javax.servlet.http.HttpServlet;
9 import javax.servlet.http.HttpServletRequest;
10 import javax.servlet.http.HttpServletResponse;
12 import compbio.statistic.CassandraRequester;
13 import compbio.statistic.StatisticsProt;
16 * Servlet implementation class ProtServlet
18 @WebServlet("/ServletSequenceProtein")
19 public class ServletSequenceProtein extends HttpServlet {
20 private static final long serialVersionUID = 1L;
23 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
26 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
27 final long startTime = System.currentTimeMillis();
28 String flag = request.getParameter("protein");
29 String prot = request.getParameter("prot");
30 String search = request.getParameter("Search");
31 int counter = Integer.parseInt(request.getParameter("counterJob"));
32 CassandraRequester cr = new CassandraRequester();
33 if (search.equals("Search counter")) {
34 request.setAttribute("result", cr.readProteinByCounter(counter));
36 request.setAttribute("result", cr.readProteins(prot, flag));
38 final long endTime = System.currentTimeMillis();
39 request.setAttribute("timeExecution", (endTime - startTime));
40 request.setAttribute("prot", prot);
41 request.setAttribute("flag", flag);
42 request.setAttribute("search", search);
43 request.setAttribute("counter", counter);
44 RequestDispatcher rd = request.getRequestDispatcher("/ReportSequenceProtein.jsp");
45 rd.forward(request, response);
49 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
52 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
53 doGet(request, response);