Spring MVC (3.0) considers URLs with and without trailing slashes as the same URL.
For example:
http://www.example.org/data/something = http:
If there aren't many of those, you can configure redirect views like this
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addRedirectViewController("/my/path/", "/my/path")
.setKeepQueryParams(true)
.setStatusCode(HttpStatus.PERMANENT_REDIRECT);
}
But interceptors occur before requests are mapped to a specific Controller.action and you've got no way of knowing Controllers and actions in that context.
All you've got is HTTPServlet API and request+response; so you can:
response.sendRedirect("http://example.org/whitout-trailing-slash");
This behavior (URL with trailing slash = URL without it) is perfectly "valid" when considering HTTP. At least this is the default behavior with Spring, that you can disable with useTrailingSlashMatch (see javadoc).
So using rewrite/redirect rules on the front-end server could a solution; but again, I don't know your constraints (maybe you could elaborate on this and we could figure out other solutions?).