0

Given the spring mvc method like the one below.

@RequestMapping(value="/owners/{ownerId}/pets/{petId}/edit")
public String processSubmit(@PathVariable("ownerId", int ownerId, 
                            @PathVariable("petId") int petid) {

}

Is there some way to write the method so that all the URI templates variables are passed in as a map to the handler? something along the lines of ?

@RequestMapping(value="/owners/{ownerId}/pets/{petId}/edit")
public String processSubmit(Map<String,Object> allPathVariables) {
     Integer ownerId = allPathVariables.get("ownerId");
     Integer petId = allPathVariables.get("petId"); 
}

Is there a way to put all the URI templates in a Map that is passed to a handler method?

1 Answer 1

1

Looks like this can't be done with Spring MVC 3.1 there is an issue for it on the spring JIRA which is marked fixed for Spring MVC 3.2 https://jira.springsource.org/browse/SPR-9289

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.