Jim Preston wrote:
>
> 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.

Actually, the mapping rules are defined in the Servlet API spec. There are
for types of valid mappings:

* Exact path mapping, e.g. the URI /foo is mapped to a specific servlet (or JSP)
* Prefix path mapping, e.g. a /foo/* mapping directs all URIs starting with
  /foo/ to the specified servlet (or JSP)
* Extension mapping, e.g. a *.foo mapping directs all URIs ending with .foo
  to the specified servlet (or JSP).
* The default mapping, / sends all URIs not matched by one of the other
  mappings the specified servlet (or JSP).

In other words, you can not use a pattern like "/foo/*.jsp", but you can use
"/foo/*" to let one servlet handle all requests starting with "/foo".

See <http://java.sun.com/products/servlet/> for details.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
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

Reply via email to