我的 Flex 应用程序如何知道数据何时过时?
我有一个 100% 基于 Flex 的企业 Web 应用程序,带有 Java/BlazeDS 后端。为了创造更快捷的用户体验,我想在登录后立即将一堆数据加载到客户端并在整个会话中保持它。
这将包括诸如用户首选项、应用程序皮肤、应用程序布局等在服务器上不经常更新的内容。
我的问题是,如果它们被更新,刷新客户端数据的好方法是什么......并知道何时刷新?我应该说我对Adobe LCDS没有兴趣!
I have a 100% Flex based enterprise web application with a Java/BlazeDS backend. In order to create a more snappy user experience I'd like to load a bunch of data into the client right after logging in and hold it the entire session.
This would include items such as user preferences, application skins, application layouts, etc. Things that are infrequently updated on the server.
My question is, in case they are updated, what's a good approach for refreshing the client side data...and knowing when to refresh? I should say that I have no interest in Adobe LCDS!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要更新客户端中缓存的数据,当服务器上的数据发生更改时,您需要使用支持服务器推送的服务器端软件,并告诉客户端需要更新。
LiveCycle 是一款支持此功能的服务器端软件。我怀疑你已经知道这一点,因为你在问题中指出了这一点。
GraniteDS 是另一个,由于它是 FOSS,因此可能更符合您的喜好。
我怀疑 WebORB 也支持推送功能,但不要让我这么认为。
如果你不想在服务器端做任何事情;您可以在某个计时器上设置从客户端到服务器的调用。
To update data cached in the client, when that data changes on the server, you'll need to use a server side software that supports server push and will tell the client that an update is needed.
LiveCycle is one server side software that supports this. I suspect you already knew that, since you call it out in your question.
GraniteDS is another, and since it is FOSS it may be more to your liking.
I suspect WebORB also supports push functionality, but don't hold me to that.
If you don't want to do anything server side; you could set up a call from the client to the server on some timer.
从本质上讲,Flex 几乎是单向的,您只能通过使用 HTTPRequest 将数据获取到 Flex 中 - 您不能只将数据发送到 Flex 客户端(至少不能使用 Apache)。最好的选择是在 Flex 应用程序中本地存储首选项数据的时间戳,并使用 httprequest 定期(即每五分钟)查找本地时间戳是否仍与后端应用程序中的数据时间戳匹配。
Well by nature Flex is pretty much one-way and you can only get data into Flex by using an HTTPRequest - you can't just send data to a Flex client (at least not using Apache). Your best bet is to store a timestamp of preference data locally in the Flex app and use an httprequest to look up if the timestamp locally still matches the timestamp of the data in your backend app at a regular interval (ie every five minutes).