I am checking out click as a possible contender for some work I am
doing, but I have a little query. Is it possible to have click use path
based url's instead of query based ones?
i.e.
http://domain.com/text-demo.htm?actionLink=update
becomes:
http://domain.com/text-demo/update
I know it's a long-shot but this would really make a difference.
If you use Apache HTTPD in front of your Tomcat instance, than you can
activate mod_rewrite to do this for you (this is how many projects do
it: e.g. all PHP based too).
For other servers there are similar modules for rewriting.
If you use purely Java for your servers than, as Bob already answered,
you can use URLRewriteFilter.
This is already explained in the Click FAQ:
http://click.apache.org/docs/faq.html#alternative-extension
If you don't want to use URLRewriteFilter, than you can do the rewriting
quite simply with a ServletFilter:
- Create a custom ServletFilter that will call an:
- Extended by you javax.servlet.http.HttpServletResponseWrapper
and a
javax.servlet.http.HttpServletResponseWrapper
In these two wrapper classes you can directly modify/manipulate the
URLs(and of course practically the entire request or response) at your wish.
Adrian.