1
|
|
/* Generated by AspectJ version 1.0.5 */
|
2
|
|
package org.apache.cactus.server;
|
3
|
|
import org.apache.commons.logging.Log;
|
4
|
|
import org.apache.commons.logging.LogFactory;
|
5
|
|
import java.io.IOException;
|
6
|
|
import javax.servlet.Filter;
|
7
|
|
import javax.servlet.FilterChain;
|
8
|
|
import javax.servlet.FilterConfig;
|
9
|
|
import javax.servlet.ServletException;
|
10
|
|
import javax.servlet.ServletRequest;
|
11
|
|
import javax.servlet.ServletResponse;
|
12
|
|
import javax.servlet.http.HttpServletRequest;
|
13
|
|
import javax.servlet.http.HttpServletResponse;
|
14
|
|
|
15
|
|
/**
|
16
|
|
* Generic Filter redirector that calls a test method on the server side.
|
17
|
|
*
|
18
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
19
|
|
*
|
20
|
|
* @version $Id: FilterTestRedirector.html,v 1.1 2003/04/14 12:27:31 sinisa Exp $
|
21
|
|
* @see FilterTestCaller
|
22
|
|
*/
|
23
|
|
public class FilterTestRedirector implements Filter {
|
24
|
|
/**
|
25
|
|
* The logger
|
26
|
|
*/
|
27
|
|
private static Log LOGGER;
|
28
|
|
/**
|
29
|
|
* The filter configuration object passed by the container when it calls
|
30
|
|
* <code>init(FilterConfig)</code>
|
31
|
|
*/
|
32
|
|
private FilterConfig config;
|
33
|
|
/**
|
34
|
|
* Handle the request. Extract from the HTTP request paramete the
|
35
|
|
* Service to perform : call test method or return tests results.
|
36
|
|
*
|
37
|
|
* @param theRequest the incoming HTTP request which contains all needed
|
38
|
|
* information on the test case and method to call
|
39
|
|
* @param theResponse the response to send back to the client side
|
40
|
|
* @param theFilterChain contains the chain of filters.
|
41
|
|
* @exception IOException if an error occurred during test on server side
|
42
|
|
* @exception ServletException if an error occurred during test on server
|
43
|
|
* side
|
44
|
|
*/
|
45
|
50
|
public void doFilter(ServletRequest theRequest, ServletResponse theResponse,
|
46
|
|
FilterChain theFilterChain) throws IOException, ServletException {
|
47
|
50
|
FilterTestRedirector.LOGGER.debug("------------- Start Filter service");
|
48
|
50
|
FilterImplicitObjects objects = new FilterImplicitObjects();
|
49
|
50
|
objects.setHttpServletRequest((HttpServletRequest)theRequest);
|
50
|
50
|
objects.setHttpServletResponse((HttpServletResponse)theResponse);
|
51
|
50
|
objects.setFilterConfig(this.config);
|
52
|
50
|
objects.setServletContext(this.config.getServletContext());
|
53
|
50
|
objects.setFilterChain(theFilterChain);
|
54
|
50
|
FilterTestController controller = new FilterTestController();
|
55
|
50
|
controller.handleRequest(objects);
|
56
|
|
}
|
57
|
|
|
58
|
|
/**
|
59
|
|
* Initialise this filter redirector. Called by the container.
|
60
|
|
*
|
61
|
|
* @param theConfig the filter config containing initialisation
|
62
|
|
* parameters from web.xml
|
63
|
|
*/
|
64
|
4
|
public void init(FilterConfig theConfig) {
|
65
|
4
|
this.config = theConfig;
|
66
|
|
}
|
67
|
|
|
68
|
|
/**
|
69
|
|
* Provided so that it works with containers that do not support the
|
70
|
|
* latest Filter spec yet ! (ex: Orion 1.5.2 !)
|
71
|
|
*
|
72
|
|
* @param theConfig the Filter Config
|
73
|
|
*/
|
74
|
1
|
public void setFilterConfig(FilterConfig theConfig) {
|
75
|
1
|
this.config = theConfig;
|
76
|
|
}
|
77
|
|
|
78
|
|
/**
|
79
|
|
* Provided so that it works with containers that do not support the
|
80
|
|
* latest Filter spec yet ! (ex: Orion 1.5.2 !)
|
81
|
|
*
|
82
|
|
* @return the Filter Config
|
83
|
|
*/
|
84
|
0
|
public FilterConfig getFilterConfig() {
|
85
|
0
|
return this.config;
|
86
|
|
}
|
87
|
|
|
88
|
|
/**
|
89
|
|
* Destroy the filter. Called by the container.
|
90
|
|
*/
|
91
|
4
|
public void destroy() {
|
92
|
|
}
|
93
|
|
|
94
|
|
/**
|
95
|
|
* Generic Filter redirector that calls a test method on the server side.
|
96
|
|
*
|
97
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
98
|
|
*
|
99
|
|
* @version $Id: FilterTestRedirector.html,v 1.1 2003/04/14 12:27:31 sinisa Exp $
|
100
|
|
* @see FilterTestCaller
|
101
|
|
*/
|
102
|
5
|
public FilterTestRedirector() {
|
103
|
5
|
super();
|
104
|
|
}
|
105
|
|
/**
|
106
|
|
* Generic Filter redirector that calls a test method on the server side.
|
107
|
|
*
|
108
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
109
|
|
*
|
110
|
|
* @version $Id: FilterTestRedirector.html,v 1.1 2003/04/14 12:27:31 sinisa Exp $
|
111
|
|
* @see FilterTestCaller
|
112
|
|
*/
|
113
|
|
static {
|
114
|
|
/**
|
115
|
|
* The logger
|
116
|
|
*/
|
117
|
5
|
FilterTestRedirector.LOGGER = LogFactory.getLog(FilterTestRedirector.class);
|
118
|
|
}
|
119
|
|
|
120
|
|
}
|