-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 André,
On 4/30/2009 8:33 AM, André Warnier wrote: > At the risk of stating the obvious : > There are two different types of redirect : > - an "internal redirect" consists of just modifying the request URL, and > recycling the request internally from the beginning. This is actually called a "forward", and is often confused with a "redirect" by lots of people. The request is /not/ "recycled" or even started-over. It is actually re-delegated (if such a term exists). If you write a filter that performs 5 forwards and then throws an exception, you'll see a stack trace that looks something like this: java.lang.Exception: Intentionally-thrown exception at my.Filter.doFilter at RequestDispatcher.forward at my.Filter.doFilter at RequestDispatcher.forward at my.Filter.doFilter at RequestDispatcher.forward at my.Filter.doFilter at RequestDispatcher.forward at my.Filter.doFilter ... Forwarding a request is actually a method call, not a reset of the request. This is important to understand because it has certain implications on the nature of the request and response objects. For one, it means you can /wrap/ a request and/or response with some other object in order to alter the behavior of the resources targeted with the forward. > - an "external redirect" means that the server sends a 301/302 HTTP > response to the browser, telling it (in another HTTP header) "and here > is the URL that you should try instead". > (in that case it is a complete URL, http://hostname included) This is really the only operation actually called "redirect". > Just to make sure that you read the documentation of URLrewriteFilter > properly, and did not miss something. Maybe they are named differently > in the documentation ? Of course urlrewrite provides a way to redirect. See http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.2/index.html#to Specifically, you set 'type="redirect"' which results in the filter executing a HttpServletResponse.sendRedirect(). Even better, the OP should use type="permanent-redirect" as it will sent a 301 response. Technically speaking, a redirect should have a complete URL (including protocol) in it, but the example shown in the user manual lacks it: <rule> <from>^/some/olddir/(.*)$</from> <to type="redirect">/very/newdir/$1</to> </rule> To do a redirect to another site, just fully-qualify the URL: <rule> <from>^(.*)$</from> <to type="redirect">http://www.siteB.de$1</to> </rule> Honestly, I haven't actually /tried/ this, but the documentation suggests that it will work. I would have tried this technique before posting back to the list (or asking a question on the surely-helpful user group for urlrewrite: http://groups-beta.google.com/group/urlrewrite). - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkn6AQoACgkQ9CaO5/Lv0PCNkQCgpYZwaTjDMBvpFMPiTd//koyL 1iYAn20m18UCZUArWpHUfP5mrIrBAhzu =dTat -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org