java - Spring RedirectView behaving differently in different tomcat installations -


i have 2 tomcat instances. both behind proxying apache httpds. code in spring controller looks this:

@requestmapping(value = "/dosupersexystuff", method = requestmethod.get) public string viewsupersexystuff() {     return "redirect:/mysupersexystuff"; } 

on first tomcat installation on windows have somedomain1.dev redirected http://localhost:8080/myapp , works flawlessly. redirect goes http://somedomain1.dev/mysupersexystuff

on other tomcat installation (which on linux) redirect works relative context path , user end @ http://somedomain2.dev/myapp/mysupersexystuff wrong.

what should spring ignore context path , redirect user "belongs"?

all urls in application absolute(everything including links in jsps, redirect urls , places links used). guess that's not correct way stuff: if have implement https version of site i'll in trouble. if you think must change fundamentally in approach please point me in right direction.

instead of returning string, inflexible, consider returning view:

@requestmapping(value = "/dosupersexystuff", method = requestmethod.get)     public view viewsupersexystuff(){     return new redirectview("/mysupersexystuff"); } 

the redirect view has constructor takes boolean contextrelative following opposite of above:

return new redirectview("/mysupersexystuff", true); 

all url's should context relative unless them point off site, links css, image assets etc. should in jsp's use <c:url /> tags resolve paths.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -