1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.rribbit.processing;
17
18 import org.rribbit.execution.ListenerObjectExecutor;
19 import org.rribbit.retrieval.ListenerObjectRetriever;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22 import org.springframework.context.ApplicationContext;
23 import org.springframework.web.context.WebApplicationContext;
24 import org.springframework.web.context.support.WebApplicationContextUtils;
25
26
27
28
29
30
31
32
33
34 public class SpringHttpRequestProcessorServlet extends HttpRequestProcessorServlet {
35
36 private static final Logger log = LoggerFactory.getLogger(SpringHttpRequestProcessorServlet.class);
37
38 protected ListenerObjectRetriever listenerObjectRetriever;
39 protected ListenerObjectExecutor listenerObjectExecutor;
40
41 @Override
42 protected ListenerObjectRetriever createListenerObjectRetriever() {
43 return listenerObjectRetriever;
44 }
45
46 @Override
47 protected ListenerObjectExecutor createListenerObjectExecutor() {
48 return listenerObjectExecutor;
49 }
50
51 @Override
52 public void init() {
53
54 log.info("Retrieving WebApplicationContext from ServletContext and getting ListenerObjectRetriever and ListenerObjectExecutor");
55
56
57 WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
58 listenerObjectRetriever = ctx.getBean(ListenerObjectRetriever.class);
59 listenerObjectExecutor = ctx.getBean(ListenerObjectExecutor.class);
60
61
62 super.init();
63 }
64 }