1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.orchestra.frameworkAdapter.basic;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24
25 import javax.servlet.Filter;
26 import javax.servlet.FilterChain;
27 import javax.servlet.FilterConfig;
28 import javax.servlet.ServletException;
29 import javax.servlet.ServletRequest;
30 import javax.servlet.ServletResponse;
31 import java.io.IOException;
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 public class BasicFrameworkAdapterFilter implements Filter
47 {
48 private final static String INIT_CONVERSATION_MESSAGER = "conversationMessagerClass";
49
50 private final Log log = LogFactory.getLog(BasicFrameworkAdapterFilter.class);
51 private BasicFrameworkAdapter adapter;
52
53 public void init(FilterConfig filterConfig) throws ServletException
54 {
55 String conversationMessager = filterConfig.getInitParameter(INIT_CONVERSATION_MESSAGER);
56
57 adapter = new BasicFrameworkAdapter(filterConfig.getServletContext(), conversationMessager);
58 }
59
60 public void doFilter(ServletRequest req, ServletResponse rsp, FilterChain filterChain)
61 throws IOException, ServletException
62 {
63 log.debug("doFilter");
64 try
65 {
66 adapter.beginRequest(req, rsp);
67 filterChain.doFilter(req, rsp);
68 }
69 finally
70 {
71 adapter.endRequest();
72 }
73 }
74
75 public void destroy()
76 {
77 }
78 }