How do I restrict route extensions in @RequestMapping paths for Spring MVC controllers? -
i have simple task want accomplish, can't seem find information spring mvc routing it. have simple controller routes path view:
@controller @requestmapping(value = "/help") public class helpcontroller { private static final string = "help"; @requestmapping(method = requestmethod.get) public string help(model model, locale locale) { model.addattribute("locale", locale); return help; } } i throw 404 if http://mysite.com/help.some.extension.is.entered, spring seems resolve example /help. javadoc says @requestmapping annotation servlet uri mapping, thought /help means needs exact match. clarification appreciated.
for spring 4 it's pretty easy solve:
<mvc:annotation-driven> <mvc:path-matching suffix-pattern="false" /> </mvc:annotation-driven> so still can use mvc:annotation-driven config.
Comments
Post a Comment