2013-04-10 123 views
0

我正在使用Spring MVC和RESTFullWebService。Spring MVC - 如何在请求映射中传递HashMap

代码片段从我的客户端程序

RestTemplate restTemplate = new RestTemplate(); 

String startProcessURL = "http://"+hostAddress+":"+portNumber+"/jBPMSpring/process/startProcess/"+processId 

上面的代码工作正常,当我使用RequestMapping.GET方法。

在我的客户端程序中,我需要在请求映射(POST)中传递HashMap。

什么改变,我需要做的传递HashMap。

回答

0

有两种选择,postForLocation或postForObject

String result = rest.postForObject("http://whatever.com/whenever/", yourClass, String.class,); 

initalizing你可以换你的HashMap在课后