RMI的替代品 [英] Alternatives to RMI

查看:95
本文介绍了RMI的替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小的Java SE应用程序,它实际上是一个坐在数据库之上的胖客户端.为了提高我的Java技能,我决定使用它来开发一个客户端-服务器应用程序.服务器应用程序与数据库进行通信并处理各种冗长的操作,而客户端应用程序仅接收结果,主要是中等长度和基元的ArrayLists.

I have a small Java SE application, it´s practically a fat client sitting on top of a database. To further my Java skills, I decided to make a client-server application out of it. The server application communicates with the database and handles all kinds of lengthy operations, while the client application only receives the results, mostly ArrayLists of moderate length and primitives.

为此,我开始阅读RMI并编写了Oracle教程,我发现它难以理解甚至难以工作.

To this end, I started reading on RMI and did the Oracle tutorial, which I found surprisingly difficult to understand and even get to work.

还有其他可以代替RMI使用的东西,而不必深入JavaEE吗?

Is there anything else I can use instead of RMI, without having to dive into JavaEE?

推荐答案

我建议的一种方法是使用 JSON 作为数据交换的格式.您可以使用 GSON 将数据从Java对象转换为JSON,然后再转换回JSON.可以使用 REST 直接在HTTP协议上完成传输.您可以将 Jersey 用作REST服务器/客户端,也可以自己滚动(因为您不想使用JEE,它是Jersey的一部分.)

One way I would suggest would be to use JSON as the format for data exchange. You can use GSON to convert the data from Java objects to JSON and back. The transport could be done directly on the HTTP protocol using REST. You can use Jersey as a REST server/client or roll your own (since you don't want to use JEE, which Jersey is part of).

这篇关于RMI的替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆