I have a mapped url to /foo.jsp
wich redirects to a controller, but it is not handled by spring and returns a 404. It seems that the url is ignored and directly send to tomcat. Is it possible to make spring handle it ?
To reproduce, starting from https://github.com/spring-projects/spring-boot/tree/1.4.x/spring-boot-samples/spring-boot-sample-tomcat7-jsp just add :
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addRedirectViewController("/foo", "/").setStatusCode(HttpStatus.MOVED_PERMANENTLY);
registry.addRedirectViewController("/foo.html", "/").setStatusCode(HttpStatus.MOVED_PERMANENTLY);
registry.addRedirectViewController("/foo.jsp", "/").setStatusCode(HttpStatus.MOVED_PERMANENTLY);
}
}
Then navigating to /foo
and /foo.html
works as expected, but /foo.jsp
returns a 404