ClientHandler/ClientHandler.cpp
// ----------------< get the list of packagees >---------------
< get the list of packagees >
< get the list of packagees >
HttpMessage ClientHandler::getFileList(HttpMessage msg) {
	std::vector<std::string> fileList = FileSystem::Directory::getDirectories("../TestFileServer/");
	std::string body = "";
	for (size_t i = 0; i < fileList.size(); ++i) 
		if(fileList[i] != "." && fileList[i] != "..")
			body += "\n  " + fileList[i];
	body += "\n";
	HttpMessage message;
	message.addAttribute(HttpMessage::attribute("toAddr", msg.findValue("fromAddr")));
	message.addAttribute(HttpMessage::attribute("fromAddr", msg.findValue("toAddr")));
	message.addAttribute(HttpMessage::attribute("type","returnList"));
	message.addBody(body);
	return message;
}
HttpMessage ClientHandler :: getFileList ( HttpMessage msg ) { std :: vector < std :: string > fileList = FileSystem :: Directory :: getDirectories ( " " ) ; std :: string body = " " ; for ( size_t i = 0 ; i < fileList . size ( ) ; ++ i ) if ( fileList [ i ] != " " && fileList [ i ] != " " ) body += " \n " + fileList [ i ] ; body += " \n " ; HttpMessage message ; message . addAttribute ( HttpMessage :: attribute ( " " , msg . findValue ( " " ) ) ) ; message . addAttribute ( HttpMessage :: attribute ( " " , msg . findValue ( " " ) ) ) ; message . addAttribute ( HttpMessage :: attribute ( " " , " " ) ) ; message . addBody ( body ) ; return message ; }
< get the list of packagees >
< get the list of packagees >