简体   繁体   English

互连应用程序-Java EE

[英]Interconnect applications- Java EE

I have 3 web applications. 我有3个Web应用程序。 They all have a common set of functionality which is an IO operation:- write to a text file and access written data. 它们都有一组通用的功能,这些功能是IO操作:-写入文本文件并访问写入的数据。 I am going to separate this function (file writing) as a single application which accepts requests from all application and write to text files and returns when they are required. 我将把此功能(文件写入)分离为一个单独的应用程序,该应用程序接受来自所有应用程序的请求并写入文本文件,并在需要时返回。

Actually this is something like a session management between browser and a server. 实际上,这类似于浏览器和服务器之间的会话管理。 Each user connect to the server is identical and each user is treated separately. 连接到服务器的每个用户都是相同的,并且分别对待每个用户。 The same is required here between 3 applications and this separated application and connected though HTTP connection . 在这3个应用程序和此分离的应用程序之间需要相同的内容,并通过HTTP连接进行连接。

Some set of instances of classes of this seperated application should be identical, seperated for each calling applications. 此分离的应用程序的某些类实例集应该是相同的,并针对每个调用应用程序进行分离。

This separated application is supposed to be deployed as a war file. 该分离的应用程序应作为战争文件进行部署。 Please guide me how I can achieve this ? 请指导我如何实现这一目标?
Will I have to use web services ? 我需要使用网络服务吗? or something like REST ful services? 或类似REST ful服务的东西? Any sample sources projects/ codes, links are highly appreciated. 任何示例源项目/代码,链接都将受到高度赞赏。

Web Service is an option, specially because it's incredibly easy to implement using JavaEE annotations. Web Service是一个选项,特别是因为使用JavaEE批注非常容易实现。

One thing you must consider in this case is to ensure proper authentication, so you can be sure your services are being properly exposed only to your desired clients. 在这种情况下,您必须考虑的一件事是确保正确的身份验证,因此可以确保仅将服务正确地提供给所需的客户端。

Other option is RMI. 其他选项是RMI。

I am used to work with Eclipse and TomEE, just in case you need any example, although, even TomEE site has some examples itself - http://tomee.apache.org/examples-trunk/simple-webservice/README.html 我使用Eclipse和TomEE,以防万一你需要的任何示例工作,虽然,甚至TomEE网站有一些例子本身- http://tomee.apache.org/examples-trunk/simple-webservice/README.html

Just to be sure, is the communication overhead necessary or could you just wrap your I/O logic into a JAR? 可以肯定的是,是否需要通信开销,还是可以将I / O逻辑包装到JAR中? This way it would be way easier :-) 这样会更容易:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM