A question mark within a @PathVariable in Spring MVC?

Posted by sp00m on Stack Overflow See other posts from Stack Overflow or by sp00m
Published on 2012-06-04T10:14:01Z Indexed on 2012/06/04 10:40 UTC
Read the original article Hit count: 215

Filed under:
|

Within the @Controller of a search engine:

@RequestMapping(value = "/search/{query}", method = RequestMethod.GET)
public String search(@PathVariable String query) {}

If a user wants to search /search/w?rld (wich should match world, warld, whrld, etc.), the variable query equals w, because of the question mark which indicated a GET var.

I tried "/search/{query:.+}", but still doesn't work.

Any idea how to solve that problem?

© Stack Overflow or respective owner

Related posts about spring-mvc

Related posts about path-variables