-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong reverse resolution #63
Comments
This happens when your servlet is configured as The code you mention is correct for the case when your url-pattern is more sophisticated, such as
Thus, a case for handing the 3rd rule there must be encoded. Scalatra seems to have the same problem currently (see scalatra/scalatra#392) |
Could one of you submit a PR with a test and/or a fix for this? |
Problem is that springmvc router can't use "/" route and handle reverse dependencies correctly. See: resthub/springmvc-router#63
I'm using spring mvc 4 with thymeleaf,
i can configure thymeleaf using RouterModelAttribute in this way i have access in my view to the router with default name 'route'
My routes.conf content:
When i do ${route.reverse('testController.foo')} it give me the value of '/test/1/test/1' which is wrong url, i expect to /test/1 which is the value mapped to testController.foo.
I have looked to the code in the reverse method:
String path = route.path;
if( currentRequest != null) {
if(!currentRequest.servletPath.isEmpty() && !currentRequest.servletPath.equals("/")) {
String servletPath = currentRequest.servletPath;
path = (servletPath.startsWith("/") ? servletPath : "/" + servletPath) + path;
}
** by removing this code the reverse method works as i should expect:
if(!currentRequest.servletPath.isEmpty() && !currentRequest.servletPath.equals("/")) {
String servletPath = currentRequest.servletPath;
path = (servletPath.startsWith("/") ? servletPath : "/" + servletPath) + path;
}
Could you confirm this issue?
The text was updated successfully, but these errors were encountered: