1
2
3
4
5
6
7
8
9
10
11 package psiprobe.controllers.sql;
12
13 import jakarta.servlet.http.HttpServletRequest;
14 import jakarta.servlet.http.HttpServletResponse;
15 import jakarta.servlet.http.HttpSession;
16
17 import java.util.List;
18
19 import org.springframework.beans.factory.annotation.Value;
20 import org.springframework.stereotype.Controller;
21 import org.springframework.web.bind.annotation.RequestMapping;
22 import org.springframework.web.servlet.ModelAndView;
23
24 import psiprobe.PostParameterizableViewController;
25 import psiprobe.model.sql.DataSourceTestInfo;
26
27
28
29
30 @Controller
31 public class QueryHistoryController extends PostParameterizableViewController {
32
33 @RequestMapping(path = "/sql/queryHistory.ajax")
34 @Override
35 public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
36 throws Exception {
37 return super.handleRequest(request, response);
38 }
39
40 @Override
41 protected ModelAndView handleRequestInternal(HttpServletRequest request,
42 HttpServletResponse response) throws Exception {
43
44 HttpSession sess = request.getSession(false);
45 List<String> queryHistory = null;
46
47 if (sess != null) {
48 DataSourceTestInfo sessData =
49 (DataSourceTestInfo) sess.getAttribute(DataSourceTestInfo.DS_TEST_SESS_ATTR);
50
51 if (sessData != null) {
52 queryHistory = sessData.getQueryHistory();
53 }
54 }
55
56 return new ModelAndView(getViewName(), "queryHistory", queryHistory);
57 }
58
59 @Value("ajax/sql/queryHistory")
60 @Override
61 public void setViewName(String viewName) {
62 super.setViewName(viewName);
63 }
64
65 }