0
我有通用控制器已編碼請求正文。我想這個控制器解碼體,並設置此解碼體,並重定向到特定的控制器。下面是我的控制器從一個控制器重定向到另一個更改正文和標題
@RequestMapping(value = "/{type}", method = RequestMethod.POST)
public String save(@RequestBody String base64Body, @PathVariable("type") String type) throws IOException {
String json = decompress(Base64.getDecoder().decode(base64Body));
//now I'd like set json to request body, change header, and redirect to "type" controller
return format("redirect:/%s/save", type);
}
上面的代碼應該叫我控制器從ADDRES /類型/保存解碼後的身體,它甚至有可能?由於
實際上這個「json =」決定了什麼? –
我的意思是你可以傳遞json作爲請求參數。 – StanislavL
我終於使用控制器自動裝配,謝謝 –