title: How to perform input validation with javax.ws.rs?
body: <p>I am implementing a REST API using <code>javax.ws.rs</code>. An implementation goal is to be as secure as possible, so every input should be validated. </p>
  
  <p>For input validation, I am implementing a public class <code>ValidatingHttpRequest</code> that implements <code>HttpServletRequest</code>.</p>
  
  <p>I could identify 11 methods which are even called, all the others now throw <code>UnsupportedOperationException</code>. However some of those methods handle things apparently used by the REST framework. For example my code does not care about headers, but <code>getHeaders</code> gets called. With a lot of reverse engineering I would be able to figure out what headers are used and should be validated, and of course I could do the validation. Possibly with introducing nonoptimal behaviours and maybe some bugs. And there are some similar aspects of the HTTP request.</p>
  
  <p>But no one did this before, possibly someone who actually knows how the REST framework works? Or is it unnecessary, as the framework itself cannot be fooled?</p>
  
  <p>So I am looking for a fully validating <code>HttpServletRequest</code> implementation, or a reasoning why it is unnecessary in this case. Of course I will validate the request body and parameters using the implementation.</p>