tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Cook" <jimc...@iname.com>
Subject Problem with RequestDispatcher
Date Tue, 22 Feb 2000 00:42:20 GMT
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


Mime
View raw message