从其他网页调用c++ web toolkit widget
Calling c++ web toolkit widget from other webpages?
我是Wt框架的新手,我只是想知道是否有可能从其他网页调用Wt自定义小部件。我的意思是,如果我做了一个Wt应用程序,别人可以把它作为api来使用其他框架来开发吗?或者我的应用程序将成为Wt专用的应用程序?
Wt有一个'widgetset'模式,在这种模式下,你可以在其他网站上显示你的Wt应用程序的小部件,类似于你如何将谷歌地图小部件添加到静态网站。
正如user52875's提到的,你需要告诉Wt你的应用是一个Wt::widgetSet。
下面是一个示例,修改自Wt的helloworld和主页示例:
#include <Wt/WServer>
#include <Wt/WText>
using namespace Wt;
class MyApp : public WApplication {
public:
MyApp(const WEnvironment& env) : WApplication(env) {
new WText("Hello", root());
}
};
WApplication *createApplication(const WEnvironment& env)
{
return new MyApp(env);
}
int main(int argc, char **argv)
{
try {
WServer server(argc, argv, WTHTTP_CONFIGURATION);
// ********** Pass 'Wt::WidgetSet' instead of 'Wt::Application' here ************
server.addEntryPoint(WidgetSet, createApplication, "/");
server.run();
} catch (Wt::WServer::Exception& e) {
std::cerr << e.what() << std::endl;
} catch (std::exception &e) {
std::cerr << "exception: " << e.what() << std::endl;
}
}
相关文章:
- 用于将C++代码转换为 Web 程序集的脚本未终止
- C# DLL 从C++应用程序调用 SOAP Web 服务
- OpenCV(C++)处理来自JavaScript / Web Assembly的图像数据
- 用于 progmem 的C++和头文件压缩的 Web 文件字节数组
- 来自带有mbedtls TLS的Mongoose Web服务器的错误消息
- 使用 ESP8266/8285 将字符串从 Web 服务器转换为字节数组
- 在 c++ WWSAPI Web 服务中处理 WS-Security PasswordDigest 模式
- libtorrent是否支持带摘要身份验证的http web种子
- 我的web应用程序的用户需要在浏览器上手动启用本机客户端吗
- Java JNI GDAL 本机库在重新部署为 Web 应用程序时出现类加载器错误
- 如何捕获从 MFC Web 浏览器 c++ 发出的 GET/POST 请求
- 在能够从 Web 浏览器访问大型数组数据的同时存储它的最可行方法是什么?
- 如何为C Web开发配置LAMPP
- 在C/C 接受JSON中创建REST Web服务
- Boost-Beast 异步 Web 套接字 服务器-客户端异步读写 不在控制台上写入输出
- 用于管理 CATIA 文件的 Web 应用程序
- 从QT的Web服务中解析未命名的JSON数组
- 可能在OpenShift3上部署C Web服务器
- 如何使用boost :: asio访问Web服务
- 从其他网页调用c++ web toolkit widget