title: Java/Spring > Handle Bad Request response for controller method with @RequestBody when no body is sent in request
body: <p>long story short: I'm creating API that is supposed to be 100% REST.
  I'm trying to overwrite default response for the following case:
  I've got a method in my @RestController that has @RequestBody as an attribute</p>
  
  <pre><code>@RequestMapping(value = {"register"}, method = RequestMethod.POST, produces = "application/hal+json")
  public Resource&lt;User&gt; registerClient(@RequestBody User user, HttpServletRequest request)
  </code></pre>
  
  <p>and the method is working just fine if I send a proper request. But there is a problem when I don't. When a request has empty body, I get a generic Tomcat error page for status 400 and I need it to send just a string or a JSON object instead.</p>
  
  <p>So far I tried to add Exception Handlers in my RestControllerAdvice for all Spring exceptions from package org.springframework.web.binding, but it didn't work either. </p>
  
  <p>I'm already aware that for some security-related errors one have to create handlers in configuration, but I don't know if this is the case.</p>
  
  <p>Did anyone face similar issues? Is there something I'm missing?</p>