1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.hack23.cia.web.impl.ui.common;
20
21 import javax.servlet.http.HttpServletRequest;
22 import javax.servlet.http.HttpServletResponse;
23
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26 import org.springframework.context.ApplicationEvent;
27 import org.springframework.context.ApplicationListener;
28 import org.springframework.context.annotation.Configuration;
29 import org.springframework.jmx.export.annotation.ManagedAttribute;
30 import org.springframework.jmx.export.annotation.ManagedOperation;
31 import org.springframework.jmx.export.annotation.ManagedResource;
32 import org.springframework.web.servlet.ModelAndView;
33 import org.springframework.web.servlet.mvc.AbstractController;
34
35
36
37
38 @ManagedResource(objectName = "Configuration:name=securityController")
39 @Configuration(value="securityController")
40 public class SecurityControllerImpl extends AbstractController implements SecurityController,ApplicationListener<ApplicationEvent> {
41
42
43 private final static Logger LOGGER = LoggerFactory
44 .getLogger(SecurityControllerImpl.class);
45
46
47 private boolean opened = true;
48
49
50
51
52 @ManagedOperation
53 public void close() {
54 opened = false;
55 }
56
57
58
59
60
61
62 @ManagedAttribute
63 public boolean isOpened() {
64 return opened;
65 }
66
67
68
69
70 @ManagedOperation
71 public void open() {
72 opened = true;
73 }
74
75
76
77
78 @Override
79 public void verifyRequest(final HttpServletRequest request,
80 final HttpServletResponse response) throws Exception {
81 }
82
83
84
85
86 @Override
87 protected ModelAndView handleRequestInternal(final HttpServletRequest request,
88 final HttpServletResponse response) throws Exception {
89 LOGGER.info(request.toString());
90 return null;
91 }
92
93
94
95
96 @Override
97 public void onApplicationEvent(final ApplicationEvent event) {
98 LOGGER.info(event.toString());
99 }
100
101 }