Project

General

Profile

Bug #812 ยป hello.C

Daniel Walter, 05/05/2011 06:19 PM

 
#include <Wt/WServer>
#include <Wt/WApplication>
#include <Wt/WEnvironment>
#include <Wt/WContainerWidget>
#include <Wt/WLogger>

using namespace Wt;

class ExampleApplication: public WApplication {
public:
ExampleApplication(const WEnvironment& env)
:WApplication(env)
{
internalPathChanged().connect(this, &ExampleApplication::logInternalPath);
}

private:
void logInternalPath(const std::string& path) {
log("path") << path;
}
};

WApplication *createWtShowtimeApplication(const WEnvironment& env) {
return new ExampleApplication(env);
}

int main(int argc, char **argv) {
try {
WServer server(argv[0]);
server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);

server.addEntryPoint(Application, createWtShowtimeApplication);

if (server.start()) {
WServer::waitForShutdown();
server.stop();
}
} catch (Wt::WServer::Exception& e) {
std::cerr << e.what() << std::endl;
} catch (std::exception &e) {
std::cerr << "exception: " << e.what() << std::endl;
}

}
    (1-1/1)