コード例 #1
0
ファイル: RowFormatter.cpp プロジェクト: aleks-f/articles
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		response.setChunkedTransferEncoding(true);
		//response.setContentType("text/html");

		Path path(_file);
		if (File(path).exists())
		{
			std::string mime = "application/binary";
			std::string ext = path.getExtension();
			if (ext == "html" || ext == "htm" || ext == "js" || ext == "css" || ext == "xml")
				mime = "text/" + ext;
			
			response.sendFile(_file, mime);
		}
		else
		{
			response.setStatusAndReason(HTTPResponse::HTTP_NOT_FOUND);
			response.send();
		}
	}
コード例 #2
0
ファイル: WebNotifier.cpp プロジェクト: 1514louluo/poco
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		response.setChunkedTransferEncoding(true);
		response.sendFile("WebNotifier.html", "text/html");
	}