On Wednesday 13 February 2002 04:15 am, you wrote:

> This document describes what can be done for modifying urls.
> Based on your email, it won't be enough for you, but it should
> make it clear that the part of the turbine urls that your
> client wants to hide is constrained by the servlet spec.
> <http://jakarta.apache.org/turbine/turbine-2/howto/url-rewriting-howto.html>

I recently discovered that you can use a path prefix mapping in your web.xml 
that will allow your URLs to be shorter then those mentioned in the URL 
Rewriting Howto.

Intead of:
http://www.foo.com/po/s/la/template/Foo.vm

You can easily achieve:
http://www.foo.com/po/la/template/Foo.vm

using the following servlet mapping in your web.xml:
    <servlet-mapping>
        <servlet-name>Turbine</servlet-name>
        <url-pattern>/la/*</url-pattern>
    </servlet-mapping>

If you make your webapp use the empty context path "" (in Tomcat you can do 
this by placing your webapp in ./webapps/ROOT, the URL is shortened even 
further to:
http://www.foo.com/la/template/Foo.vm

Other options to consider for making pretty URLs work with Turbine include:
1. Using a jsp:forward like Luke Holden mentioned in another post.
2. Using mod_rewrite like Eric Dobbs mentioned.
3. Hacking the Turbine servlet (Turbine.java) to make it work with a servlet
   extension mapping of *.vm.  You could check out the *.jsp and *.shtml
   servlets that come with Tomcat for ideas on how to implement this.  The
   main caveat is that PATH_INFO will always be null in this scenario.
4. You could write your own servlet to replace the default servlet for the
   webapp, using the default servlet mapping, /.  PATH_INFO will also be null
   in this scenario.  Your custom servlet could map pretty URLs to the ugly
   Turbine URLs by using a RequestDispatcher.forward().  Check out the
   servlet invoker that comes with Tomcat for ideas on how to implement this.

In all 4 cases, you will need to write your own $link tool to generate the
appropriate URLs, whereas if you use the abovementioned path prefix mapping, 
you can use the $link tool that comes with Turbine as is.

I hope this clears things up for everyone.  I am ultra busy at the moment, 
but when I get some free time, I will convert this email into an xdoc and 
submit it.

Regards,

-- Rodney

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to