Is there a way to map an URL to another URL in Spring?

I'm not familiar enough with Spring MVC to know the easiest way to do what you want there. However, the UrlRewriteFilter project makes it easy to setup rules to forward one url to another url.

You could make something easily that allows you to specify "this URL is in fact a shortcut (or alias) to this other URL" by implementing HandlerInterceptor and have your implementation contain a property that is map of URLs that should redirect, or forward, to other URLs. In your XML you just add a bean for this interceptor, and configure it which URLs should redirect to what, and add a reference to the interceptor to the SimpleUrlHandlerMapping's interceptors property.

I was also thinking to add an interceptor that catches an URL and forwards it to another, then returning false to break the execution chain. But doesn't the handler mapping have to resolve an execution chain for the incoming request? Only then the DispatcherServlet will execute the handler and interceptors found in the returned chain.So I have to map the URL to "something" and then let the interceptor handle the rest.

But what do I map it to? – dpb Dec 7 '09 at 16:04 I'm actually not sure whether the handler needs to have a mapping for each URL before you can get it to an interceptor, but if it does: map * to a 404 page (not found) and you should be good... – Fried Hoeben Dec 8 '09 at 7:19.

Keep the Spring config files clean and rewrite/manage your URLs outside. Have a look at tuckey.org/urlrewrite/.I hope it helps, -florin.

I finally ended up creating a separate URL handler mapping where I grouped together the URL aliases. I then resorted to a very detailed description of what the contained mappings are all about, something like: theController ... theController ...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions