A web application always has, at some point, the need to deal with multiple types of content. Common content types include JSON, XML, HTML, but there could also be images or even videos to be stored and streamed. Play! 2 provides a clean way of dealing with such content types with the help of body parsers.
We won't cover the implementation details of such body parsers, because it's purely based on a functional concept, Iteratee, and thus their implementations are in Scala only. However, we'll see how they are used and how we can gain benefits from them.
In this chapter, we'll update and clean up a bit of what we have been doing so far in order to enable several workflows. So we will only be using examples we have learned up to now. The following is what will be achieved:
Make the
Chat
andItem
classes persistent using EbeanCreate a link between an item and a user (a user's reply in a chat)
Introduce a new type,
Image
, that will be part of a chat as an attachment...