1
2
3
4
5
6
7
8
9
10
11 package psiprobe.controllers.connectors;
12
13 import jakarta.inject.Inject;
14 import jakarta.servlet.http.HttpServletRequest;
15 import jakarta.servlet.http.HttpServletResponse;
16
17 import java.util.List;
18
19 import org.springframework.web.bind.ServletRequestUtils;
20 import org.springframework.web.servlet.ModelAndView;
21
22 import psiprobe.beans.ContainerListenerBean;
23 import psiprobe.controllers.AbstractTomcatContainerController;
24 import psiprobe.model.Connector;
25
26
27
28
29 public class BaseGetConnectorController extends AbstractTomcatContainerController {
30
31
32 @Inject
33 private ContainerListenerBean containerListenerBean;
34
35
36
37
38
39
40 public ContainerListenerBean getContainerListenerBean() {
41 return containerListenerBean;
42 }
43
44
45
46
47
48
49 public void setContainerListenerBean(ContainerListenerBean containerListenerBean) {
50 this.containerListenerBean = containerListenerBean;
51 }
52
53 @Override
54 protected ModelAndView handleRequestInternal(HttpServletRequest request,
55 HttpServletResponse response) throws Exception {
56 String connectorName = ServletRequestUtils.getStringParameter(request, "cn");
57 Connector connector = null;
58
59 if (connectorName != null) {
60 List<Connector> connectors = containerListenerBean.getConnectors(false);
61 for (Connector conn : connectors) {
62 if (connectorName.equals(conn.getProtocolHandler())) {
63 connector = conn;
64 break;
65 }
66 }
67 }
68
69 return new ModelAndView(getViewName(), "connector", connector);
70 }
71
72 }