Craig R. McClanahan wrote:
>"Rogatkin, Dmitry M" wrote:
>
>> > While agreeing with Milt's reasoning, I would point out at least one
>> > significant feature that you give up when you override the service()
>> method --
>> > conditional GET support. This allows your servlet (if it appropriately
>> > implements the getLastModified() method and does *not* override the
>> standard
>> > service() method) to send back a NOT_MODIFIED response to the client,
and
>> thus
>> > avoid having to download a page that has not changed since the last
time
>> it
>> > was requested.
>> Why calling super.service() doesn't work in this case?
>>
>
>Yes, calling super.service() will perform the conditional GET support, but
it
>will also do everything else it already does, including call your
>doGet()/doPost()/etc. method.
Sorry to disappoint you fans of getLastModified() :-), but I actually tried
to use the conditional GET support implemented in service() and found it to
be be next to useless in a real environment. I ended up having to write it
myself.
Geoff
here's a copy of the relevant stuff I sent to the API feedback...
1) it doesn't allow you to easily share state with doGet(), which you almost
always want to do
2) there's no easy way co-ordinate error handling between getLM() and
doGet() (you can't even throw a ServletException from getLM()).
3) getLM() will set LastModified even if doGet() fails and throws an
exception. This means that the client will try and cache your "error" page
(unless you do a sendError() or somesuch).
I suggested that making the logic in gLM() available to be called from
_within_ doGet() would be much more useful in general.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html