使用 Spring MVC 流式传输数据
Streaming data with Spring MVC
我正在寻找使用 Twitter4J 设置 Twitter 流。我计划能够使用关键字进行搜索。我也想使用 Spring MVC,因为这是我最近经常使用的东西。
但是,我想流式传输无限量的推文,而不会在用户交互之前停止查看。我不太确定使用 Spring.
是否可行
有人可以就这是否可行给我一些建议,并指出一些文档以便我阅读吗?或者使用 Java 和 Spring 是否使我的问题过于复杂,我最好完全使用不同的技术。
从未使用过 twitter4J,但就 Spring 而言,它只是为您提供了一个架构。使用 Spring 开发变得更容易,因为您不必时不时地编写样板代码,此外还有许多其他使用 Spring 的充分理由。如果您需要在 UI 上连续 activity 流式传输,则需要实施 Ajax (polling) or a server side push technology like Atmosphere, Spring Reactor.
Or whether using Java and Spring is over complicating my problem and I
would be better using a different technology altogether.
如果您的应用程序非常基础且代码量最少,您也可以使用 servlet 编写它。 Twitter4J 是 java 库,因此您必须坚持使用 Java 您不能实施任何不同的技术。
您可以在 STOMP (see reference doc and a chat application example) 中使用 Spring 的 websocket 支持,从 4.0 开始就支持它。
或者您也可以使用最新的 HTTP Streaming support(目前在 4.2.0.RC1)。
我正在寻找使用 Twitter4J 设置 Twitter 流。我计划能够使用关键字进行搜索。我也想使用 Spring MVC,因为这是我最近经常使用的东西。 但是,我想流式传输无限量的推文,而不会在用户交互之前停止查看。我不太确定使用 Spring.
是否可行有人可以就这是否可行给我一些建议,并指出一些文档以便我阅读吗?或者使用 Java 和 Spring 是否使我的问题过于复杂,我最好完全使用不同的技术。
从未使用过 twitter4J,但就 Spring 而言,它只是为您提供了一个架构。使用 Spring 开发变得更容易,因为您不必时不时地编写样板代码,此外还有许多其他使用 Spring 的充分理由。如果您需要在 UI 上连续 activity 流式传输,则需要实施 Ajax (polling) or a server side push technology like Atmosphere, Spring Reactor.
Or whether using Java and Spring is over complicating my problem and I would be better using a different technology altogether.
如果您的应用程序非常基础且代码量最少,您也可以使用 servlet 编写它。 Twitter4J 是 java 库,因此您必须坚持使用 Java 您不能实施任何不同的技术。
您可以在 STOMP (see reference doc and a chat application example) 中使用 Spring 的 websocket 支持,从 4.0 开始就支持它。
或者您也可以使用最新的 HTTP Streaming support(目前在 4.2.0.RC1)。