[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: Container <-> protocol dependancy
2006/3/1, Ilya A. Volynets-Evenbakh <ilya@total-knowledge.com>:
>
> Krzysztof Rzymkowski wrote:
>
> >Here are my point on why not to do
> > HttpServletRequest request (req);
> >
> >1. ServletRequest's methods (as in JavaServlet API) do not provide
> enought
> >information to allow the creation of HttpServletRequst. For example how
> can
> >I create a RequestDispather having only a ServletRequest?
> >
> >
> Bad example - RequestDispatcher is part of javax.servlet package,
> not javax.servlet.http, and theoretically servlet might request
> non-HTTP resource through getRequestDispatcher() interface
> (presuming different kinds of servlet can live within same
> ServletContext, which is something that isn't clear to me).
Indeed. Not a very good example.
>2. HttpServletRequest extends the functionality of ServletRequest. It
> should
> >only inherit from ServletRequest. It's not supposed to be a wrapper on
> >ServletRequest.
> >
> >
> "Not supposed to be"? ;-)
> There is nothing wrong with providing extended object that wraps
> around some other object of base class. It isn't used often, and it
> doesn't make sense often, but is reasonable under certain
> circumstances.
Saying "not supposed to be" I mean that creators of the JavaServlet API
meant HttpServletRequest to extend ServletRequest, not wrap it.
HttpServletRequest does not have a constructor taking a ServletRequest.