resthub / springmvc-router

Adds route mapping capacity to any "Spring MVC based" webapp. Uses playframework.org Router implementation.
http://resthub.github.com/springmvc-router/
Other
167 stars 63 forks source link

RouterHandlerResolver doesn't work for all cases #14

Closed electrotype closed 11 years ago

electrotype commented 12 years ago

The RouterHandlerResolver#findActionMethod() method doesn't always work if the controller has two overloaded versions of a method.

For example, it doesn't distinguish those two methods ( taken from Spring Social's org.springframework.social.connect.web.ConnectController ) :

public String connectionStatus(NativeWebRequest request, Model model)

and

public String connectionStatus(@PathVariable String providerId, NativeWebRequest request, Model model)

If my routes are :

GET     /connect/{providerId}/?                                     connectController.connectionStatus
GET     /connect/?                                                          connectController.connectionStatus

and I call "/connect", the wrong method is used and I get an exception :

org.springframework.web.bind.ServletRequestBindingException: Missing URI template variable 'providerId' for method parameter type [java.lang.String] 

I guess what is missing is something similar to the "best match" algorithm used by Spring. @PathVariable annotations and such should be taken in account to find the correct method.