Documentation: Add section about content negotiation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
play framework |
Fix Committed
|
Undecided
|
Peter Hilton |
Bug Description
It would be great if the routes or controller documentation would shortly describe how to make use of the content negotiation provided by Play! framework (and discuss the format fallback strategy).
Related Google Groups Thread: http://
Guillaume Bort (27 Okt. 2009, 16:40)
In fact if the Accept header is not suitable for you, you can even use
different URL path. For example, in conf/routes:
GET /index Application.index
GET /index.xml Application.
You can even extract the format information, dynamically from the URL path
GET /index.{format} Application.index
Guillaume Bort (27 Okt. 2009, 16:55)
Currently the only content type resolved by the engine itself are only
txt,html,json and xml.
But I agree it's lame, and surely it should be pluggable.
However you can easily do it yourself either by specifying the correct
format value for a special URL in the route file, or using a @Before
interceptor that examine the Accept header:
@Before
static void setFormat() {
}
}
And it will finally render the index.vcf template and set
automatically response mime-type to text/v-card.
tags: | added: documentation |
I'll see if I can pull all of this together into a new documentation section.