You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the current spring-boot update (see above) the link building via WebMvcLinkBuilder produces broken urls when the request mapping contains regular expressions in PathVariables. I could reproduce this issue with a mapping example from spring-docs:
@TestvoidaSpringDocExampleThatIsBroken() {
WebMvcLinkBuilderlinkBuilder = linkTo(methodOn(DemoController.class).handle("artifact", "1.1.1",".jar"));
Stringurl = linkBuilder.withSelfRel().getTemplate().expand().toString();
// failsassertThat(url).isEqualTo("http://localhost/spring-web/artifact-1.1.1.jar");
// the result is http://localhost/spring-web/artifact
}
I tested this bug in different variations. It's always the first PathVariable with a regular expression, that is evaluated correctly
but the following PathVars are ignored then and the url gets cut.
The text was updated successfully, but these errors were encountered:
Likely to be a side effect of the fix for #1412, #1413, #1414. Looking into it. One thing: you say "since the current Boot upgrade" which seems to imply that the expansion had properly worked before. #1412 was actually fixed because the regular expressions would not have been removed at all before. Can you confirm? You should be able to manually downgrade Spring HATEAOS to 1.2.2 by setting the spring-hateoas.version property to that version in your POM.
…ressions.
Switched to manual parsing of template variables as regular expressions can contain { and } characters which makes matching variables using these as delimiters impossible.
Related ticket: #1412.
odrotbohm
changed the title
link creation with WebMvcLinkBuilder uncomplete when PathVariables need regex evaluation
Multiple template variables using regular expression break link creation
Feb 10, 2021
spring-boot 2.4.2, spring-hateoas 1.2.3
Since the current spring-boot update (see above) the link building via WebMvcLinkBuilder produces broken urls when the request mapping contains regular expressions in PathVariables. I could reproduce this issue with a mapping example from spring-docs:
Here's a snippet from my DemoController.java
and a unittest that shows the current bug:
I tested this bug in different variations. It's always the first PathVariable with a regular expression, that is evaluated correctly
but the following PathVars are ignored then and the url gets cut.
The text was updated successfully, but these errors were encountered: