For this recipe, we will explore how Play Framework provide APIs for HTTP request and response filters. HTTP filters provide a way to transparently decorate a HTTP request or response and is useful for lower-level services (such as response compression), gathering metrics, and more in-depth logging.
It is also worth noting that presently (as of Play 2.3.7), HTTP filters are best implemented using the Play Scala API with the play.api.mvc.EssentialFilter trait. So for this recipe, we will implement a Scala-based filter for our Java recipe.
For Java, we need to take the following steps:
foo_javaapplication with Hot-Reloading enabled.