tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Isaacs <Larry.Isa...@sas.com>
Subject RE: Handler/ServletWrapper/Error handling
Date Sat, 09 Dec 2000 14:33:43 GMT
Hi Costin,

This sounds fine.  I'll look forward to seeing your patches.

I have been wrestling with porting the error handling changes I made
to Tomcat 3.2.  From this I have some suggestions and a question.

Suggestion 1) In Handler and ServletWrapper some calls are made to
contextM.handleStatus() and contextM.handleError().  I think it would
be an improvement to add handlerStatus() and handleError() to
Handler, which would make the call to contextM.handleXXX.  This would
allow, ServletWrapper could hook these if needed.  For example,
a ServletWrapper.handleError() could check for UnavailableExceptions
and take some action if desired.

Suggesion 2) Since "inclusion", as far as I can tell, is only implemented
in RequestDispatcherImpl it could be considered a Servlet 2.2 thing.
With Suggestion 1 above, tests for res.isIncluded() could move to
ServletWrapper.  I'm not sure if Handler needs to be "inclusion" aware.

Question) Mainly to provide better default output for UnavailableExceptions, I was looking
to implement an interceptor in
facade22, say Servlet22ErrorHandler, that could provide additional error
handling support.  Preferrably it could override some of ErrorHandler's behavior, as opposed
to replacing ErrorHandler completely. There is a
general problem with this with regard to the order the contextInit()
and handleError() methods would be called.  Servlet22ErrorHandler would
want its contextInit() called after ErrorHandler's, but would want its
handleError() called before ErrorHandler's!?  Maybe handleError() methods
could be called in reverse order of appearance in server.xml?  Or is
ErrorHandler only replacable?  Ideas?

If the suggestions make sense in your patches go ahead and include them.
If not, let me know if you want to -1 them.

I'll wait for your changes and before committing any error handling changes.

Larry

-----Original Message-----
From: cmanolache@yahoo.com
To: Larry Isaacs
Sent: 12/8/00 10:45 PM
Subject: Handler/ServletWrapper/Error handling

Hi Larry,

I try to simplify Handler/ServletWrapper, and I don't want to brake your
previous change. 

I think I found a solution to eliminate most of the ugly code, but it
needs few changes in the way the errors are handled.

My proposal is:

- Handler's service, init, destroy will be final and will not throw any
exception. Inside init, destroy, service we'll code the ( un-modifiable
) logic to call pre/post, synchronization and error handling.

- doService, doInit, doDestroy will throw exception and will be
overriden in handlers and ServletWrapper.

- the pre/post service should move to Handler - we should call them for
internal handler as well ( static, error ) - the interceptor can find if
the handler is internal or not.

I think I'll finish tomorow most of this, it would be great if you could
review it next week and either -1 it or let me know where to
change. Handler is one of the worst places in the current core.

Costin

Mime
View raw message