title: How to use onRouteRequest in play 2.4?
body: <p>How to write this this scala implementation of "onRouteRequest"(from - <a href="https://jazzy.id.au/2013/05/08/advanced_routing_in_play_framework.html" rel="nofollow">https://jazzy.id.au/2013/05/08/advanced_routing_in_play_framework.html</a>)</p>
  
  <pre><code>override def onRouteRequest(req: RequestHeader): Option[Handler] = {
    (req.method, req.path) match {
      case ("GET", "/") =&gt; Some(controllers.Application.index)
      case ("POST", "/submit") =&gt; Some(controllers.Application.submit)
      case _ =&gt; None
    }
  }
  </code></pre>
  
  <p>in java in play 2.4 ? How to create Handler object to return in java ?</p>
  
  <p>(I do not want to owerride OnRequest, or to use {} in routing , i do not want redirecting, triing to do dynamic router where seo url for certain controller can change in administration, but am stuck at this scala implementation that is mentioned everywhere with no java implementation)</p>