tomcat-dev mailing list archives

I am programmatically chaining servlets to facilitate a portal site I am
developing. I found it necessary to use the facade pattern to wrap the
HttpServletRequest object in my portal's doGet() method. In this method, I
make a call to the RequestDispatcher's include() method.
Turns out the RequestDispatcher.include() method uses the following line:
Request realRequest = ((HttpServletRequestFacade)request).getRealRequest();
Of course, I was passing *my* PortalRequestFacade object and I get a class
cast exception. Is it necessary to assume this type of cast? Wouldn't it be
better to have two include() methods, such as:
public void include(ServletRequest request, ServletResponse response);
public void include(HttpServletRequestFacade request,
HttpServletRequestFacade response) {
Request realRequest = request.getRealRequest();
Response realResponse = response.getRealResponse();
include (realRequest, realResponse);
}
I would extend your facade class to facilitate my needs, however I would
like this to be a portable solution.
thanks,
jim