English 中文(简体)
游戏框架: "游戏开始"的奇怪行为 - 缓冲问题?
原标题:Playframework: Strange behavior of "play start" - Caching issue?

我正在开发一个网络应用程序, 使用游戏框架 2 。 我在 / 公共目录下创建了一个文件夹“ 文件 ” 。 当我使用“ 播放运行” 启动服务器时, 该目录下的所有资源都可以访问 。

安装到服务器后。 我通过运行“ 播放开始” 开始服务器, 发现“ 文件” 下的资源已无法找到 。

我想知道什么是"游戏开始"和"游戏运行"之间不一致的原因

更新: 经过几次试验后。 我发现它无法显示新上传的资源。 假设情况如下 :

1. play start --> server starts.
2. use application to upload a few images to the server.
3. try to display the uploaded image --> nothing is shown. browser shows the resource is not accessible.
4. kill the server process with task manager.
5. rm RUNNING_PID
6. run play start again 
7. Try to display the uploaded image --> now the images are showing.

So, looks like a "hot update" issue with "play start" Is there any configuration I can do to let the server pick up the change? Thanks.

最佳回答

Where exactly did you store the image? At compile time, the static assets are copied from /public to /target/scala-2.9.1/classes/public. This directory is part of the class path and the assets are served from there. So, if you store files there at runtime, they should be found.

副注释 : 它可能不是一个可持续的解决方案, 因为由您的用户装入的图像会在下一个构建期间被删除 。 也许你应该考虑在应用程序安装之外使用一个符号链接( 注意! 安全性议题! ), 或者将资产存放在别处, 数据库或 S3 总是好的替代方案 。

问题回答

依据 @Joerg Viola s 回答。 我决定执行我自己的动作来为静态资源服务。 结果发现它非常容易。 从这个链接 , 我学会用一条线执行文件服务器 。





相关问题
Manage dependencies in a Play Framework app

I m trying to figure out the proper tools for managing dependencies between JARs. I have a Play Framework app, which imports a JAR (based on another project I m writing). This JAR imports other JARs, ...

Deploy Play! application as executable jar

Is it possible to bundle Play! web application to executable jar instead of war? Could it just be run on localhost at some port just like when using "play run" command? (without the need of installing ...

JPA: Store fileAttachment into the database

I would like to know if there is any way I can store a fileAttachment directly into the database with JPA. I have an attribute: public fileAttachement logo; I have tried to change it to: @Lob ...

Java Web Development and Automatic Feedback

I ve been having a (ironic) play around with the Play Framework and have been impressed thus far. I was just curious as to what other Java frameworks are out there that have a similar feature to Play ...

Java web frameworks

I was looking around to see if there is an equivalent to django/RoR in java. I found: Play Framework Grails Does anyone have ever tried those frameworks, or do you know any other? Are they faster ...

热门标签