How to set content type : text/cache-manifest ?

525 views
Skip to first unread message

Stephane Piette

unread,
Aug 22, 2011, 12:43:17 PM8/22/11
to play-fr...@googlegroups.com
Hi,

I'm trying the HTML5 local storage function.
For this, I need my play server to provide a cache-manifest file, with the mime type  'text/cache-manifest'

How can I do this in the routes files ??

Thanks

Guillaume Bort

unread,
Aug 23, 2011, 5:26:52 AM8/23/11
to play-fr...@googlegroups.com
You can declare custom mime types in application.conf file:

# Custom mime types
# mimetype.xpi=application/x-xpinstall

> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/yZZAZUTIEoEJ.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.
>

--
Guillaume Bort, http://guillaume.bort.fr

Stephane Piette

unread,
Aug 23, 2011, 6:20:36 AM8/23/11
to play-fr...@googlegroups.com
Ok thanks for the tips !

I added this in application.conf :
# mimetype.xpi=application/x-xpinstall
mimetype.mf=text/cache-manifest

And then I made a Manifest Controller with :
 
public static void manifest(){
request.format = "mf";
render();
}

And the view file is "manifest.mf".

It works, but it looks ugly ...
Is there a way to set type for static file (without controller, like CSS, JS), with a trick in routes file

Romain Piel

unread,
Jun 21, 2012, 4:36:06 AM6/21/12
to play-fr...@googlegroups.com
Actually I found out it's much simpler to do this with Play! 2.0.
There's no need to specify the MIME type, it seems to be automatically detected.


Le jeudi 21 juin 2012 10:15:41 UTC+2, Romain Piel a écrit :
Any easier way to do that using Play 2.0?
Reply all
Reply to author
Forward
0 new messages