diff --git a/Main/ghttp.cpp b/Main/ghttp.cpp index c83a72d..16f91cf 100644 --- a/Main/ghttp.cpp +++ b/Main/ghttp.cpp @@ -326,7 +326,21 @@ int initialize(int argc, char *argv[]) // server.resource["^/query/(.*)$"]["GET"] = [&server](shared_ptr response, shared_ptr request) { }; + //GET-example for the path /?operation=query&format=[format]&sparql=[sparql], responds with the matched string in path + server.resource["^/?operation=query&format=(.*)&sparql=(.*)$"]["GET"] = [&server](shared_ptr response, shared_ptr request) + { + query_handler(server, response, request); + // server.resource["^/query/(.*)$"]["GET"] = [&server](shared_ptr response, shared_ptr request) { + }; + //NOTICE:this may not be visited by browser directly if the browser does not do URL encode automatically! + //In programming language, do URL encode first and then call server, then all is ok + server.resource["^/%3[F|f]operation%3[D|d]monitor$"]["GET"]=[&server](shared_ptr response, shared_ptr request) + { + //server.resource["^/monitor$"]["GET"]=[&server](shared_ptr response, shared_ptr request) { + monitor_handler(server, response, request); + }; + //NOTICE:this may not be visited by browser directly if the browser does not do URL encode automatically! //In programming language, do URL encode first and then call server, then all is ok server.resource["^/?operation=monitor$"]["GET"]=[&server](shared_ptr response, shared_ptr request) @@ -357,6 +371,11 @@ int initialize(int argc, char *argv[]) { checkpoint_handler(server, response, request); }; + //TODO: use db_name if multiple databases + server.resource["^/?operation=checkpoint$"]["GET"]=[&server](shared_ptr response, shared_ptr request) + { + checkpoint_handler(server, response, request); + }; //TODO: add user name as parameter, current using or all databases availiable server.resource["^/%3[F|f]operation%3[D|d]show$"]["GET"]=[&server](shared_ptr response, shared_ptr request) @@ -364,6 +383,12 @@ int initialize(int argc, char *argv[]) show_handler(server, response, request); }; + //TODO: add user name as parameter, current using or all databases availiable + server.resource["^/?operation=show$"]["GET"]=[&server](shared_ptr response, shared_ptr request) + { + show_handler(server, response, request); + }; + //USAGE: in endpoint, if user choose to display via html, but not display all because the result's num is too large. //Then, user can choose to download all results in TXT format, and this URL is used for download in this case //WARN: this URL rule should not be published! @@ -1011,8 +1036,13 @@ bool default_handler(const HttpServer& server, const shared_ptr