java - Spring RequestMapping: differentiate PathVariable with different types -


is there way tell spring map request different method type of path variable, if in same place of uri?
example,

@requestmapping("/path/{foo}")    @requestmapping("/path/{id}") 

if foo supposed string, id int, possible map correctly instead of looking request uri?

according spring docs possible use regex path variables, here's example docs:

@requestmapping("/spring-web/{symbolicname:[a-z-]+}-{version:\\d\\.\\d\\.\\d}{extension:\\.[a-z]+}")   public void handle(@pathvariable string version, @pathvariable string extension) {     // ...   } } 

(example taken http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-patterns )

judging that, should possible write situation:

@requestmapping("/path/{foo:[a-z]+}")    @requestmapping("/path/{id:[0-9]+}") 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -