/** @file @author Stefan Frings */ #include "dumpcontroller.h" #include #include DumpController::DumpController(){} void DumpController::service(HttpRequest& request, HttpResponse& response) { response.setHeader("Content-Type", "text/html; charset=ISO-8859-1"); response.setCookie(HttpCookie("firstCookie","hello",600)); response.setCookie(HttpCookie("secondCookie","world",600)); QByteArray body(""); body.append("Request:"); body.append("
Method: "); body.append(request.getMethod()); body.append("
Path: "); body.append(request.getPath()); body.append("
Version: "); body.append(request.getVersion()); body.append("

Headers:"); QMapIterator i(request.getHeaderMap()); while (i.hasNext()) { i.next(); body.append("
"); body.append(i.key()); body.append("="); body.append(i.value()); } body.append("

Parameters:"); i=QMapIterator(request.getParameterMap()); while (i.hasNext()) { i.next(); body.append("
"); body.append(i.key()); body.append("="); body.append(i.value()); } body.append("

Cookies:"); i=QMapIterator(request.getCookieMap()); while (i.hasNext()) { i.next(); body.append("
"); body.append(i.key()); body.append("="); body.append(i.value()); } body.append("

Body:
"); body.append(request.getBody()); body.append(""); response.write(body,true); }