#include #include #include #include #include #include using namespace Wt; // ----------------------------------------------------------------------------------- std::unique_ptr createHelloApplication(const WEnvironment &env) { auto app = std::make_unique(env); auto theme = std::make_shared(); app->setTheme(theme); auto mainVLayout = app->root()->setLayout(std::make_unique()); auto ta = mainVLayout->addWidget(std::make_unique(), 1); WString longText; for (int i = 0; i < 300; i++) longText += "Line " + std::to_string(i) + "\n"; ta->setText(longText); return app; } // ----------------------------------------------------------------------------------- int main(int argc, char *argv[]) { try { WServer server(argc, argv, WTHTTP_CONFIGURATION); server.addEntryPoint(EntryPointType::Application, std::bind(&createHelloApplication, std::placeholders::_1)); if (server.start()) { int sig = WServer::waitForShutdown(); std::cerr << "*** Shutdown (signal = " << sig << ")" << std::endl; server.stop(); if (sig == 1) // SIGHUP WServer::restart(argc, argv, environ); return 0; } } catch (WServer::Exception &e) { std::cerr << "*** Server Exception: " << e.what() << std::endl; } catch (std::exception &e) { std::cerr << "*** Std Exception: " << e.what() << std::endl; } }