title: How to validate Java API @HeaderParam before execution of method
body: <p>I have this endpoint method:</p>
  
  <pre><code>@RequestMapping(value = "/update")
  public ResponseEntity(Response) update(
          @ApiParam(required=true) @Valid @RequestBody Request request,
          @RequestHeader @HeaderParam("key") String key
      ){
  
      //execution of code here
  
      return null;
  }
  </code></pre>
  
  <p>I'm currently validating the Request Body using a custom JSON Deserializer.</p>
  
  <p>Is there anyway that I could validate the Header Param "key" similar to the way I would validate a Request Body using a JSON Deserializer?</p>
  
  <p>Maybe something like this that would execute before the "//execution of code here":</p>
  
  <pre><code>@Override
  public String deserialize(String key){
      if(!key.equals("ABC")){
          throw new Exception("key is wrong");
      }
      return key;
  }
  </code></pre>
  
  <p>Thank you!</p>