-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug
Milestone
Description
Amr Mostafa opened SPR-11391 and commented
@RequestMapping("/user/{userId}/contacts")
class UserContactController {
@RequestMapping("/create")
@ResponseBody
public String showCreate(@PathVariable Integer userId) {
return MvcUriComponentsBuilder.fromMethodName(UserContactController.class, "showCreate", userId).build().getPath();
}
}
Assuming this is running in a servlet mapped at "/", then requesting: http://localhost/user/123/contacts/create is expected to output:
/user/123/contacts/create
But the actual output is:
/user/{userId}/contacts/create
If we change the code to the following:
class UserContactController {
@RequestMapping("/user/{userId}/contacts/create")
@ResponseBody
public String showCreate(@PathVariable Integer userId) {
return MvcUriComponentsBuilder.fromMethodName(UserContactController.class, "showCreate", userId).build().getPath();
}
}
Then the expected result is displayed.
Affects: 4.0 GA, 4.0.1
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug