Hi James,
This topic comes up fairly often, and for a good reason - there's often no other
way of handling things cleanly.
One example is trying to use a servlet approach for authorization, where you
really want to have all requests run through a single servlet which in turn
either passes them on for default processing or sends back an error page if the
user does not have access. If everything you're doing is in Java code you
control (i.e., have the source for and can modify as necessary) then the request
dispatcher approach would work, with some possibly substantial extra effort.
Otherwise, you're left with having to write custom code for your particular web
server (which probably will need to be in C/C++, something I really try to
avoid). I've been through this myself in one enterprise application.
Perhaps some thought should be given to how a standardize form of servlet
chaining (hopefully letting servlets chain to static pages or other forms of
content as well) could be added to the spec. This would allow servlets to be
used more as components which can be hooked together in various ways, rather
than restricting them to only being the destinations for user requests.
- Dennis
Dennis M. Sosnoski
Sosnoski Software Solutions, Inc.
http://www.sosnoski.com
James Davidson wrote:
>
> > You need to look at servlet chaining I think.
> > Either that or meld the 3 servlets into one.
>
> Servlet chaining is non-portable between servers -- it's not even part of the
> servlet specification. Use request dispatchers instead, or better yet, refactor
> your application.
>
> Remember that servlets should be an "entry point" into your application -- just
> like `public static void main(String[] args)`. You wouldn't call component
> through their public static void main methods in most cases, why should your
> servlets be any different? Food for thought.
>
> .duncan
>
> ___________________________________________________________________________
> 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
___________________________________________________________________________
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