----- Original Message ----- From: "Konstantin Kolinko" <[email protected]>
To: "Tomcat Users List" <[email protected]>
Sent: Saturday, September 04, 2010 11:06 AM
Subject: Re: URL Rewrite


2010/9/4 michel <[email protected]>:
----- Original Message ----- From: "Ognjen Blagojevic"
<[email protected]>
To: "Tomcat Users List" <[email protected]>
Sent: Friday, September 03, 2010 6:42 AM
Subject: Re: URL Rewrite


On 3.9.2010 12:02, michel wrote:

I have been using the tuckey urlrewrite with some results, in that if I
want to have an incoming URL coming in as
gallery/pic20 gets changed to gallery.jsp?pic=20
But the tool bar URL gets displayed as gallery.jsp?pic=20
and I want to display gallery/pic20

Just use rule, not outbond-rule:

<rule>
<from>/gallery/pic([0-9]+)</from>
<to>/gallery.jsp?pic=$1</to>
</rule>

Thanks, and I have it working at times (worked all day on this) but it seems
unreliable. I am expecting that the very same code would work if I had
'forward' or 'redirect', but it doesn't.


If you need a filter to be invoked not only on user's requests, but
also when processing forwards and includes inside of your own webapp,
you have to configure its mapping in web.xml so that those are passed
to it. See the Servlet spec for details.

If that is what you mean by forwards and redirects.

If you do a client-side redirect (sending a response with HTTP status
302 or 301, 303, 307), the URL where you sent your client will be
displayed in her browser's location bar.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Konstantin, I fixed the problem! The problem was in the links in the HTML code. If I do a redirect, then the URL in http: shows the true URL, and the links in the page were using it for building the reklative address.

Example:

with http://www.smith.com html code <img src="heading/can-post.gif"> is really

http://www.smith.com/heading/can-post.gif


in a forward the http in the toolbar might be http://www.smith.com/cleanurl


so the image is http://www.smith.com/cleaurl/heading/can-post.gif

and it can't be found.

The solution is to have


<base href=http://www.smith.com/> in the page, so the URL building uses that instead of the misleading URL in the toolbar.










---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to