在这里创建了Java一个HttpRequest是一个控制器我在我的web应用程序有:Spring MVC的 - 的控制器
@RequestMapping(value = "/createAccount", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(value = HttpStatus.OK)
@ResponseBody
public ResponseDTO createAccount(@RequestBody PlayerAccountDTO playerAccountDTO,
HttpServletRequest request) {
this.playerService.createAccount(playerAccountDTO);
return new ResponseDTO();
}
该控制器通过AJAX使用后,并传递一个JSON和杰克逊映射照顾被称为作为POJO(Nice!)
我现在想要做的是: 在另一个web应用程序中,我想用http post请求传递PlayerAccountDTO给这个确切的控制器,并且当然会收到ResponseDTO 。
我希望尽可能简单。
是否有可能实现这一目标?这里是我的wishfull溶液(在不同的Web应用程序服务):
public ResponseDTO createAccountOnADifferentWebApp() {
PlayerAccountDTO dto = new PlayerAccountDTO(...);
ResponseDTO result = httpRequestPost(url, dto, ResponseDTO.class);
return result;
}