Hi All,
I've noticed some interesting behaviour in C2 with the use of
RequestDispatcher objects in T4M2. The following code is taken from
T4M2 (ApplicationRequest.java && ApplicationHttpRequest.java):
line 215 && 387 resp.:
while (request != null) {
if (request instanceof Request)
break;
* if (!(request instanceof ServletRequestWrapper)) {
throw new IllegalArgumentException
(sm.getString("applicationRequest.badRequest"));
}
request = ((ServletRequestWrapper) request).getRequest();
}
The code was found during a trace of what happens when one does a
request.getRequestDispatcher("xyz").forward(request, response);
in some XSP code.
The T4M2 code unfortunately throws an IllegalArgumentException (at the
*) as it expects a ServletRequestWrapper instance - and we pass it a
Cocoon 2 internal HttpRequest object which doesn't inherit from
ServletRequestWrapper (implements HttpServletRequest).
Question is, what can we do about it ? ServletRequestWrapper is a
Servlet 2.3 thing so we would wipe out all the T3 users if we changed
HttpResponse to extend from it (then again.. C2 seems to be really a
T4 app anyway.. :-) ).
To fix the problem I changed HttpEnvironment.java to store the
original servlet parameters as well as the C2 custom ones, and changed
ServletGenerator.java to use these values for the XSP request/response
variables. Patch is attached.
This was a bit of a hack though. Any other ideas about to tackle this
one ?
Cheers,
Marcus
BTW - should mails like this really go to cocoon-dev or is
cocoon-users more appropriate ?
--
.....
,,$$$$$$$$$, Marcus Crafter
;$' '$$$$: Computer Systems Engineer
$: $$$$: Open Software Associates GmbH
$ o_)$$$: 82-84 Mainzer Landstrasse
;$, _/\ &&:' 60327 Frankfurt Germany
' /( &&&
\_&&&&' Email : Marcus.Crafter@osa.de
&&&&. Business Hours : +49 69 9757 200
&&&&&&&: After Hours : +49 69 49086750
|