14 #include <qhttpserver.h>
15 #include <qhttprequest.h>
16 #include <qhttpresponse.h>
28 this->setObjectName(
"WebServerWidget");
29 this->setWindowTitle(
"Web Server");
30 this->setWhatsThis(this->defaultWhatsThis());
37 this->shutdownServer();
40 void WebServerWidget::initServer()
43 CX_LOG_INFO() << QString(
"Starting REST server on port %1...").arg(mPort);
44 mServer =
new QHttpServer(
this);
47 connect(mServer, SIGNAL(newRequest(QHttpRequest*, QHttpResponse*)),
48 mRequestHandler.get(), SLOT(handle_request(QHttpRequest*, QHttpResponse*)));
52 void WebServerWidget::shutdownServer()
54 mRequestHandler.reset();
65 mServer->listen(mPort);
73 QString WebServerWidget::defaultWhatsThis()
const
76 "<h3>WebServer plugin.</h3>"
77 "<p>Used to run a WebServer from CustusX</p>"