title: Rest template delete method
body: <p>I'm trying to delete user by passing his id to Rest service.</p>
  
  <p>Service controller:</p>
  
  <pre><code>@RequestMapping(value = "/remove/{id}", method = RequestMethod.DELETE)
  public @ResponseBody ResponseEntity&lt;String&gt; removeUser(@PathVariable("id") int id) throws JsonProcessingException {
      User user = this.userService.getUserById(id);
      System.out.println(id);
      if (this.userService.getUserById(user.getId()) != null) {
          this.userService.deleteUser(user.getId());
          return new ResponseEntity&lt;String&gt;(HttpStatus.OK);   
      }
  
      return new ResponseEntity&lt;String&gt;(error("Sorry, an error occured!"), HttpStatus.NOT_FOUND);
  }
  </code></pre>
  
  <p>User service controller:</p>
  
  <pre><code>@RequestMapping("user/delete/{id}")
  public String delete(@PathVariable Integer id, Model model){
      String uri = new String("http://localhost:8050/MavenSpringSafeHouse/remove/" + id);
  
       java.util.Map&lt;String,String&gt; params = new HashMap&lt;String, String&gt;();
          params.put("id", "2");
          RestTemplate restTemplate = new RestTemplate();
          restTemplate.delete ( uri,  params );
      return "redirect:/users";
  }
  </code></pre>
  
  <p>Error:</p>
  
  <p>type Exception report</p>
  
  <p>message Request processing failed; nested exception is org.springframework.web.client.HttpClientErrorException: 404 Not Found</p>
  
  <p>description The server encountered an internal error that prevented it from fulfilling this request.</p>
  
  <p>exception</p>
  
  <p>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.client.HttpClientErrorException: 404 Not Found
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)</p>