2013-04-10 122 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在課後