You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bruno Georges <Br...@glencore.com> on 2005/12/15 14:20:43 UTC

Re: URL rewriting best practice?

Kristian

you can write a servlet filter for this. It will be easier that way.
mod_rewrite is one way of doing it , but if you are going to target only
your JSP I would recommend to go to the servlet filter way.
You could also use valves, but you can do almost the same things with
servlet filter.

Example of  class is:

public final class URLRewriteFilter implements Filter {

      // you have to implement this method
      public void doFilter(ServletRequest request, ServletResponse
response, FilterChain chain)
            throws IOException, ServletException {

            // you code goes here
            chain.doFilter(request, response);
    }
}

If you need help implementing it, just let me know.

With Best Regards

Bruno Georges

Glencore International AG
Tel. +41 41 709 3204
Fax +41 41 709 3000


|---------+--------------------------->
|         |           Kristian Rink   |
|         |           <kristian@zimmer|
|         |           428.net>        |
|         |                           |
|         |           15.12.05 11:37  |
|         |           Please respond  |
|         |           to "Tomcat Users|
|         |           List"           |
|         |                           |
|---------+--------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                                  |
  |        To:      Tomcat Users List <us...@tomcat.apache.org>                                                                                      |
  |        cc:                                                                                                                                       |
  |        Subject: URL rewiting best practise?                                                                                                      |
  |                                                                                                                                                  |
  |Distribute:                                                                                                                                       |
  |Personal?               |-------|                                                                                                                 |
  |                        | [ ] x |                                                                                                                 |
  |                        |-------|                                                                                                                 |
  |                                                                                                                                                  |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|





Hi all;

currently I'm into deploying a small jsp/servlet based application which
more or less utilizes a dispatcher servlet to provide .jsp-based
content. For that, I'm into using URLs like

http://foobar:8080/Site?path=home/users

to, in example, show the site section "home -> users". For now, I'd like
to do URL rewriting in order to provide users with an URL like

http://foobar:8080/home/users or maybe
http://foobar:8080/Site/home/users


to see the same content. My initial idea was to use apache, mod_jk and
mod_rewrite to do right this, but don't feel too good about that idea
because sooner or later the site URL will also have to carry around a
session ID and in that I am afraid that URL rewriting will get me into
trouble. So, my question: What is the best way of doing URL rewriting in
such a situation? Does tomcat provide any ways of achieving what I want?

TIA and bye,
Kris

--
Kristian Rink *  http://zimmer428.net * jab: kawazu@jabber.ccc.de
icq: 48874445 *  fon: ++49 176 2447 2771

"Be yourself the kind of change you want to see in this world." (Gandhi)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




LEGAL DISCLAIMER. The contents of this e-mail and any attachments are strictly
confidential and they may not be used or disclosed by someone who is not a
named recipient.
If you have received this email in error please notify the sender by replying
to this email inserting the word "misdirected" as the message and delete this
e-mail from your system.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: URL rewriting best practice?

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Bruno Georges wrote:

> you can write a servlet filter for this. 

... or use an existing one:  <http://tuckey.org/urlrewrite/>

FWIW!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                          dream.  code.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: URL rewriting best practice?

Posted by Kristian Rink <kr...@zimmer428.net>.
Hi Bruno;

Bruno Georges schrieb:
> you can write a servlet filter for this. It will be easier that way.
> mod_rewrite is one way of doing it , but if you are going to target only
> your JSP I would recommend to go to the servlet filter way.
> You could also use valves, but you can do almost the same things with
> servlet filter.
> 
> Example of  class is:
> 
> public final class URLRewriteFilter implements Filter {
[...]


Okay, so I'll try that approach, seems to be better than relying upon
mod_rewrite in this situation. Thanks for your help!

Bye,
Kris

-- 
Kristian Rink *  http://zimmer428.net * jab: kawazu@jabber.ccc.de
icq: 48874445 *  fon: ++49 176 2447 2771

"Be yourself the kind of change you want to see in this world." (Gandhi)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org