/* */ #include "XmlRpcMethod.h" #include "DownloadEngine.h" #include "LogFactory.h" #include "RecoverableException.h" #include "message.h" #include "OptionParser.h" #include "OptionHandler.h" #include "Option.h" #include "array_fun.h" #include "download_helper.h" #include "XmlRpcRequest.h" #include "XmlRpcResponse.h" #include "prefs.h" #include "StringFormat.h" #include "RequestGroupMan.h" #include "FileAllocationEntry.h" #include "CheckIntegrityEntry.h" #include "ServerStatMan.h" #include "FileEntry.h" #include "DlAbortEx.h" namespace aria2 { namespace xmlrpc { XmlRpcMethod::XmlRpcMethod(): _optionParser(OptionParser::getInstance()), _logger(LogFactory::getInstance()) {} SharedHandle XmlRpcMethod::createErrorResponse (const Exception& e) { SharedHandle params = Dict::g(); params->put("faultCode", Integer::g(1)); params->put("faultString", std::string(e.what())); return params; } XmlRpcResponse XmlRpcMethod::execute (const XmlRpcRequest& req, DownloadEngine* e) { try { return XmlRpcResponse(0, process(req, e)); } catch(RecoverableException& e) { if(_logger->debug()) { _logger->debug(EX_EXCEPTION_CAUGHT, e); } return XmlRpcResponse(1, createErrorResponse(e)); } } template static void gatherOption (InputIterator first, InputIterator last, const std::set& allowedOptions, const SharedHandle