May 2015
Intermediate to advanced
274 pages
5h 11m
English
According to HTTP:
Content negotiation is the process of selecting the best representation for a given response when there are multiple representations available.
It can either be server-driven or agent-driven or a combination of both, which is called transparent negotiation. Play provides support for server-driven negotiations. This is handled by the rendering trait and is extended by the controller trait. The controller trait is the one where the controller objects in a Play app extend.
Let's look at the Rendering trait:
trait Rendering { object render { //Tries to render the most acceptable result according to the request's Accept header value. def apply(f: PartialFunction[MediaRange, Result])(implicit request: RequestHeader): ...Read now
Unlock full access