简体   繁体   English

通过JSON调用将命令发送到应用程序

[英]Sending commands to application via JSON call

I wrote a java application that is supposed to run on a server in the background 24/7. 我编写了一个Java应用程序,该应用程序应该在24/7的后台服务器上运行。 I would like implement a possibility to communicate a change of parameters to this application over the internet. 我想实现一种可能性,可以通过互联网将此参数的更改传达给此应用程序。 The easiest way that came to my mind was if the application would just get parameters via a JSON call. 我想到的最简单的方法是,应用程序是否仅通过JSON调用获取参数。 It checks this JSON every now and then and thereby "retrieves" new commands, instead of "receiving" them. 它会不时检查此JSON,从而“检索”新命令,而不是“接收”它们。

To realize this I was looking for a simple way to create and edit a JSON online that can be called by a single URL. 为了实现这一点,我正在寻找一种简单的在线创建和编辑JSON的方法,该方法可以由单个URL调用。 I have found http://www.json-generator.com/ but unfortunately it doesn't let me edit an existing JSON. 我已经找到了http://www.json-generator.com/,但是很遗憾,它不允许我编辑现有的JSON。

Does anyone know a solution for this? 有谁知道解决方案吗? Or does anyone know a simpler way to communicate with your application over the internet? 还是有人知道通过Internet与您的应用程序通信的更简单方法?

Thanks! 谢谢!

Hi maybe it's not the most correct and beautiful way to achieve your goal but I suggest you Netty.io 嗨,也许这不是实现目标的最正确,最漂亮的方法,但我建议您使用Netty.io

You can create a kind of "snoop server" or custom server protocol for sending commands to your application and receive an answer about your request (for example if everything went OK or if you crushed on some error). 您可以创建一种“探听服务器”或自定义服务器协议,以将命令发送到您的应用程序,并接收有关您的请求的答案(例如,如果一切正常,或者由于某些错误而崩溃)。

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

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