title: Spring MVC - creating an httprequest with java for a controller
body: <p>here is one controller i got on my web application:</p>
  
  <pre><code>@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();
  }
  </code></pre>
  
  <p>This controller is being called via ajax using post and passing a json and jackson mapper takes care for it to arrive as a POJO (Nice!)</p>
  
  <p>What i would like to do now is:
  In a different web application i would like to call with http post request passing PlayerAccountDTO  to this exact controller and ofcourse recieve the ResponseDTO.</p>
  
  <p>I would like that to be as simple as possible.</p>
  
  <p>Is it possible to achieve that?  here is my wishfull solution (a service on a different web app):</p>
  
  <pre><code>public ResponseDTO createAccountOnADifferentWebApp() {
  
      PlayerAccountDTO dto = new PlayerAccountDTO(...);
  
      ResponseDTO result = httpRequestPost(url, dto, ResponseDTO.class);
  
              return result;
  }
  </code></pre>