title: How would I implement an Interceptor/Filter in play framework 2.4.3 (Scala)
body: <p>I am new to Play Framework, and I wanted to implement an interceptor or a filter that gets executed before the request goes to the Action class. </p>
  
  <p>I wanted an interceptor/filter that to return HTTP error (e.g. 401), if a certain header variable is not present.</p>
  
  <p>I did some googling, and I found out about the Filter (play.api.mvc.Filter) object, but the implementation returns mvc.Result, instead of Response.</p>
  
  <blockquote>
    <p>override def apply(next: (mvc.RequestHeader) => Future[mvc.Result])(request: mvc.RequestHeader) </p>
  </blockquote>
  
  <p>Another solution that I can think of is to create a customized Action by extending ActionBuilder, but I'd rather not do that, If I can design a catch all functionality like Filter.</p>
  
  <p>Any help will be greatly appreciated. Thank you.</p>