1
2
3
4
5
6
7
8
9
10
11 package psiprobe.controllers.threads;
12
13 import jakarta.servlet.http.HttpServletRequest;
14 import jakarta.servlet.http.HttpServletResponse;
15
16 import org.springframework.beans.factory.annotation.Value;
17 import org.springframework.stereotype.Controller;
18 import org.springframework.web.bind.ServletRequestUtils;
19 import org.springframework.web.bind.annotation.RequestMapping;
20 import org.springframework.web.servlet.ModelAndView;
21 import org.springframework.web.servlet.mvc.AbstractController;
22
23 import psiprobe.Utils;
24
25
26
27
28 @Controller
29 public class ImplSelectorController extends AbstractController {
30
31
32 private String impl1Controller;
33
34
35 private String impl2Controller;
36
37
38
39
40
41
42 public String getImpl1Controller() {
43 return impl1Controller;
44 }
45
46
47
48
49
50
51 @Value("forward:/th_impl1.htm")
52 public void setImpl1Controller(String impl1Controller) {
53 this.impl1Controller = impl1Controller;
54 }
55
56
57
58
59
60
61 public String getImpl2Controller() {
62 return impl2Controller;
63 }
64
65
66
67
68
69
70 @Value("forward:/th_impl2.htm")
71 public void setImpl2Controller(String impl2Controller) {
72 this.impl2Controller = impl2Controller;
73 }
74
75 @RequestMapping(path = "/threads.htm")
76 @Override
77 public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
78 throws Exception {
79 return super.handleRequest(request, response);
80 }
81
82 @Override
83 protected ModelAndView handleRequestInternal(HttpServletRequest request,
84 HttpServletResponse response) throws Exception {
85 boolean forceOld = ServletRequestUtils.getBooleanParameter(request, "forceold", false);
86 if (!forceOld && Utils.isThreadingEnabled()) {
87 return new ModelAndView(impl2Controller);
88 }
89 return new ModelAndView(impl1Controller);
90 }
91
92 }