I think that what you're currently doing for servlets under JRun is
essentially all there is to it. Jason's book gives an example using the Java
Web Server. I've used JRun myself and configuring aliases is done the same
way as in JWS. I'm not enough of a server expert to know if this is true of
all servers, but I would kind of think it has to be.
Somewhere in the server's administration GUI (or you might have to edit the
appropriate configuration file directly for some servers) there is a way to
set up aliases. This is what tells the server how to handle different file
types, or what to do with certain URIs. So, for example, a typical default
alias is that "/servlet" maps to the servlet invoker. Another is that
"*.jsp" maps to the JSP handler. And the high-level default, "/", maps to a
simple file handler.
Jason's example shows adding an alias for "*.html" that maps to the file
handler and then a Deblink servlet (an example servlet that just looks for
"<blink>" tags and removes them). It doesn't look to me like there is any
reason that you can't add a "/foo/*.jsp" and a "/bar/*.jsp" where one maps
to the standard JSP handler and the other maps to that plus a servlet of
your choice.
--Jim Preston
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Williams, Stephen
Sent: Wednesday, July 12, 2000 9:38 AM
To: [EMAIL PROTECTED]
Subject: Re: Extending JSP pages
Jim Preston wrote:
> Actually, I believe you CAN configure the web server so that
> all requests for a "*.jsp" will be routed through a servlet
> of your choice first. I was just reading about this in Jason
> Hunter's Servlets book, but unfortunately I left it at home
> today. If you have the book, look it up, I think it's in the
> section about servlet aliases. If no one else posts more on
> this by tomorrow, I'll bring the book in and provide some
> details.
I don't have Jason Hunter's Servlets book, so I'd appreciate it if you could
describe how this could be done.
> Assuming that this does work, the potential downside is that
> it's a totally all-or-nothing solution; all JSPs will go
> through your servlet, and so you'll either have to do that
> post- and pre-processing for all JSPs that are ever served,
> or you'll have to have some logic in your servlet to
> determine which ones need it and which ones don't. This might
> be great for your environment, if you have total control over
> the server and all JSPs, but it's not a very general solution.
In order to mitigate the all-or-nothing issue, I am hopeful that the web
server could be configured to only route JSPs in a specific path to go
through my "JSP wrapper" servlet. For instance, "http://host/foo/a.jsp"
would go through my JSP wrapper servlet, whereas "http://host/bar/a.jsp"
would not. This is do-able with JRun for servlet processing, so maybe we
could do the same for JSP processing.
--
Stephen A. Williams
HNC Telecommunications Solutions
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets