使用 flex/blazeDs/Spring 处理并发文件下载
我目前正在开发 Flex3/blazeDS/Spring/MySQL 项目。 其中,部分用户需要下载一些导入日志。问题是,鉴于 spring 周围的单例概念,如果 2 个用户同时请求下载,则负责导出文件创建的 servlet 可能会在 2 个请求的文件之间交叉内容。 我对 spring 不太熟悉,但从我读到的内容来看,解决方案似乎在于说 servlet 位于“Request”范围内,因此将为每个下载请求创建一个新的,而不是有单身人士。 以前有人做过这样的事情吗?到目前为止,我看到的每个教程都解释了如何处理文件下载请求,但它从未谈到两个请求下载的用户可能会遇到一些问题的事实...
感谢您提供有关如何解决此问题的任何线索。
I'm currently working on a Flex3/blazeDS/Spring/MySQL project.
In this, some users needs to download some import logs. Problem is that given the singleton concept around spring, if 2 users ask for a download at the same time, the servlet responsible for export file creation may cross content between the 2 asked files.
I'm not that much familiar with spring but from what i've been reading around it seems that the solution lies in saying that the servlet is in "Request" scope so there will be a new one created for each download request instead of having a singleton.
Does anyone have ever done something like this before? Every tutorials i've seen so far explains how to handle file download request but it never talks about the fact that 2 users asking for a download may have some issues...
Thanks for any leads on how to fix this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每个用户都会收到自己的线程,除非使用成员变量(无论如何这是一个不好的做法),否则您不应该有任何问题。如果没有,我没有看到任何问题,但如果您可以发布代码,将会有所帮助。
Each user will receive his own thread, and you should not have any problems unless using member variables (which is a bad practice anyway). If not, I do not see any problem, but it would help if you can post your code.