I have a method that is reading the mapping info in order to work with/validate api connectors
protected String getHandlerMappingInfo(HttpServletRequest request){
RequestMappingHandlerMapping mapping = this.ctx.getBean(RequestMappingHandlerMapping.class);
RequestMappingInfo requestMappingInfo = mapping.getHandlerMethods().entrySet().stream().filter(){ entry ->
println(entry.getKey())
if(entry?.getKey() != "{ [/error]}"){
entry?.getKey()?.getMatchingCondition(request) != null
}
}.findFirst().map(){ entry ->
entry.getKey()
}.orElse(null);
return requestMappingInfo.toString()
}
This throws an identical error to #24877
09:45:50.595 [http-nio-8080-exec-1] INFO o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet'
09:45:50.596 [http-nio-8080-exec-1] INFO o.s.web.servlet.DispatcherServlet - Completed initialization in 1 ms
{GET [/*/vehicle/vehiclesByManufacturer** || /*/vehicle/vehiclesByManufacturer/**]}
java.lang.IllegalArgumentException: Expected parsed RequestPath in request attribute "org.springframework.web.util.ServletRequestPathUtils.PATH".
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.web.util.ServletRequestPathUtils.getParsedRequestPath(ServletRequestPathUtils.java:77)
at org.springframework.web.servlet.mvc.condition.PathPatternsRequestCondition.getMatchingCondition(PathPatternsRequestCondition.java:192)
at org.springframework.web.servlet.mvc.method.RequestMappingInfo.getMatchingCondition(RequestMappingInfo.java:399)
at org.springframework.web.servlet.mvc.method.RequestMappingInfo.getMatchingCondition(RequestMappingInfo.java:66)
...
I may be mistaken but I don't think this is completely fixed for all possible paths. (It also threw an error when path was "{ [/error]}" as well)
The path you see "{GET [//vehicle/vehiclesByManufacturer || //vehicle/vehiclesByManufacturer/**]}" is represented in the controller as
@RequestMapping(value = ["/vehiclesByManufacturer**","/vehiclesByManufacturer/**"], method = RequestMethod.GET)
This allows for multiple URI's to be handled by one endpoint or for an endpoint to have an ALIAS and is covered in documentation.
I believe this may not be being considered for the pathing as it is throwing an error???
Comment From: bclozel
Where is that code written and called? If this is done outside of the Spring Boot or Spring Framework codebases (for example, a custom filter), this might be a duplicate of #28874.
Comment From: orubel
No it is in springboot. Its in a filter: https://github.com/orubel/spring-boot-starter-beapi/blob/main/beapi-spring-boot-autoconfigure/src/main/groovy/io/beapi/api/filter/RequestInitializationFilter.groovy
Code is here: https://github.com/orubel/spring-boot-starter-beapi
I also added note up above; I believe this might be related to multiple @RequestMapping values
The code is a multimodule starter/autoconfig with demo project
Comment From: bclozel
That's definitely a duplicate of #28874. You custom filter is not initializing the request path. Note the comments in that linked issue saying that this is not an approach that the team supports. Thanks!