Monday, 12 August 2013

Play! Framework: Assets not accessible in Production Mode

Play! Framework: Assets not accessible in Production Mode

So I researched and found out that Play's Production mode has a different
behavior when dealing with assets than it does in Development mode.
I have a site where the user uploads an image and the image is displayed
immediately on the page after the upload. In development mode, the image
displays fine. But in production mode, the image could not be found. I
understand that in production mode, the code hasn't recognize the new file
written.
A user with a similar issue wrote a solution but it is in Scala. I am
writing in Java and don't know exactly what this user's solution is doing:
Play! Framework: File not served after upload until play clean
It seems as though this solution is serving the file as a download?
Because if it is, it's not what I need. I want to access the file to
display it using html like this:
<img src='@routes.Assets.at("images/fileName")'></img>
What can I do to access newly uploaded asset file in Production mode?

No comments:

Post a Comment