C++/Qt 的 RESTful 接口?
我想将 RESTful-API 集成到我的 Qt 项目中。
我已经阅读了此页面上的示例,但这仅适用于从 RESTful 接口接收数据,不适用于向服务器发送新数据。例如,在 Java 中,我可以使用 RESTlet,是否也可以在 Qt 中使用类似的东西?
或者是否有一种简单的方法将数据从 Qt 发送到 RESTful,例如当我之前创建 XML 时?
I want to integrate the RESTful-API in my Qt-Project.
I already read the example on this page, but this is only for receiving data from a RESTful-interface, not for sending new data to the server. In Java, I can use RESTlet for example, is there any possibility to use something like that for Qt, too?
Or is there even a simple way to send data from Qt to RESTful, for example when I create a XML before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 REST 只是普通的 URL 访问,因此您没有理由不能使用 Qt HttpClient 接口与后端 Java REST 接口进行对话。您只需决定使用 XML 还是 JSON - 两者都有非常强大的可用库,而且都只是文本接口。
你问的很奇怪,我今天自己正在做这件事 - 我正在 Java 中实现一个基于 JSON 的 REST 接口,我很快就会将管道连接到我的 Qt 应用程序。
随着我的进步,我将努力更新这个答案。
Since REST is just normal URL access, there's no reason you can't use the Qt HttpClient interfaces to talk to you backend Java REST interface. You just have to make a determination to use XML or JSON - both have very capable libraries available, and both are just text interfaces.
Odd you ask, I'm in the middle of doing this very thing myself today - I'm implementing a JSON based REST interface in Java, and I'll wire up the plumbing to my Qt app shortly.
I'll make an effort to update this answer as I progress.