java - Spring MVC URL for the AbstractController -
i have controller inherits org.springframework.web.servlet.mvc.abstractcontroller class
i have configurated in way:
<bean name="/gameservicecontroller.json" class="xx.xxx.gamecontroller"/>
so can accepts url of form
http://<hostname>:<port>/<context-path>/gameservicecontroller.json
but customer has provided me requirement write url in way
http://<hostname>:<port>/<context-path>/createnewgame?parameter=<value>
but think not possible map type of url controller. know type of configuration can used in order configure type of url mapping ?
otherwise, legal ask change format of url in way
http://<hostname>:<port>/<context-path>/gameservicecontroller.json?command=createnewgame&phonenumber=<phonenumber>
so can manage command parameter in "handlerequestinternal" method of custom controller inherits org.springframework.web.servlet.mvc.abstractcontroller class ??
don't use legacy controller framework, use annotated controllers. there, can use url templates, this:
@controller public class gamecontroller{ @requestmapping(value="/createnewgame?parameter={param}", method=requestmethod.get) public string createnewgame(@pathvariable string param, model model) { // stuff here return "viewname"; } }
Comments
Post a Comment