1
|
|
/* Generated by AspectJ version 1.0.5 */
|
2
|
|
package org.apache.cactus.server;
|
3
|
|
import java.io.IOException;
|
4
|
|
import javax.servlet.RequestDispatcher;
|
5
|
|
import javax.servlet.ServletException;
|
6
|
|
import javax.servlet.ServletRequest;
|
7
|
|
import javax.servlet.ServletResponse;
|
8
|
|
|
9
|
|
/**
|
10
|
|
* Wrapper around <code>RequestDispatcher</code> which overrides the
|
11
|
|
* <code>forward()</code> and <code>include</code> methods to use the original
|
12
|
|
* HTTP request object instead of the simulated one used by Cactus.
|
13
|
|
*
|
14
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
15
|
|
*
|
16
|
|
* @version $Id: RequestDispatcherWrapper.java,v 1.2 2002/04/14 10:35:44 vmassol Exp $
|
17
|
|
*/
|
18
|
|
public class RequestDispatcherWrapper implements RequestDispatcher {
|
19
|
|
/**
|
20
|
|
* The original request dispatcher object
|
21
|
|
*/
|
22
|
|
private RequestDispatcher originalDispatcher;
|
23
|
|
/**
|
24
|
|
* @param theOriginalDispatcher the original request dispatcher object
|
25
|
|
*/
|
26
|
0
|
public RequestDispatcherWrapper(RequestDispatcher theOriginalDispatcher) {
|
27
|
0
|
super();
|
28
|
0
|
this.originalDispatcher = theOriginalDispatcher;
|
29
|
|
}
|
30
|
|
/**
|
31
|
|
* Call the original <code>RequestDispatcher</code> <code>forward()</code>
|
32
|
|
* method but with the original HTTP request (not the simulation one which
|
33
|
|
* would make the servlet engine choke !).
|
34
|
|
*
|
35
|
|
* @param theRequest the simulation HTTP request
|
36
|
|
* @param theResponse the original HTTP response
|
37
|
|
* @exception IOException {@link RequestDispatcher#forward}
|
38
|
|
* @exception ServletException {@link RequestDispatcher#forward}
|
39
|
|
*/
|
40
|
0
|
public void forward(ServletRequest theRequest, ServletResponse theResponse) throws IOException,
|
41
|
|
ServletException {
|
42
|
0
|
HttpServletRequestWrapper request = (HttpServletRequestWrapper)theRequest;
|
43
|
0
|
this.originalDispatcher.forward(request.getOriginalRequest(), theResponse);
|
44
|
|
}
|
45
|
|
|
46
|
|
/**
|
47
|
|
* Call the original <code>RequestDispatcher</code> <code>include()</code>
|
48
|
|
* method but with the original HTTP request (not the simulation one which
|
49
|
|
* would make the servlet engine choke !).
|
50
|
|
*
|
51
|
|
* @param theRequest the simulation HTTP request
|
52
|
|
* @param theResponse the original HTTP response
|
53
|
|
* @exception IOException {@link RequestDispatcher#forward}
|
54
|
|
* @exception ServletException {@link RequestDispatcher#forward}
|
55
|
|
*/
|
56
|
0
|
public void include(ServletRequest theRequest, ServletResponse theResponse) throws IOException,
|
57
|
|
ServletException {
|
58
|
0
|
HttpServletRequestWrapper request = (HttpServletRequestWrapper)theRequest;
|
59
|
0
|
this.originalDispatcher.include(request.getOriginalRequest(), theResponse);
|
60
|
|
}
|
61
|
|
|
62
|
|
}
|