/* * Copyright (C) 2012 Jason A. Donenfeld . All Rights Reserved. * * See COPYING for license information. * */ #include "TestResponder.h" TestResponder::TestResponder() { JsonScgiServer *server = new JsonScgiServer(this); connect(server, SIGNAL(webRequest(QUrl,JsonScgiServer::Session&,QVariantMap,JsonScgiPeer&)), this, SLOT(webRequest(QUrl,JsonScgiServer::Session&,QVariantMap,JsonScgiPeer&))); server->listen(); } void TestResponder::webRequest(const QUrl &url, JsonScgiServer::Session &session, const QVariantMap &request, JsonScgiPeer &peer) { qDebug() << "Received request to url" << url; qDebug() << "Client sent this object" << request; qDebug() << "The current session expires at" << session.expiration; qDebug() << "The current session data is" << session.data; if (url.path().endsWith("notfound")) { peer.notFound(); return; } QVariantMap response; response.insert("cheese", 3); response.insert("test", "yeehaw"); peer.sendResponse(response); }