| 1 | #include "HandlerFactory.h" |
|---|---|
| 2 | #include "PingHandler.h" |
| 3 | #include "ColumnInfoHandler.h" |
| 4 | #include <Poco/URI.h> |
| 5 | #include <Poco/Net/HTTPServerRequest.h> |
| 6 | #include <common/logger_useful.h> |
| 7 | |
| 8 | namespace DB |
| 9 | { |
| 10 | Poco::Net::HTTPRequestHandler * HandlerFactory::createRequestHandler(const Poco::Net::HTTPServerRequest & request) |
| 11 | { |
| 12 | Poco::URI uri{request.getURI()}; |
| 13 | LOG_TRACE(log, "Request URI: "+ uri.toString()); |
| 14 | |
| 15 | if (uri.getPath() == "/ping"&& request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET) |
| 16 | return new PingHandler(keep_alive_timeout); |
| 17 | |
| 18 | if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST) |
| 19 | { |
| 20 | |
| 21 | if (uri.getPath() == "/columns_info") |
| 22 | #if USE_POCO_SQLODBC || USE_POCO_DATAODBC |
| 23 | return new ODBCColumnsInfoHandler(keep_alive_timeout, context); |
| 24 | #else |
| 25 | return nullptr; |
| 26 | #endif |
| 27 | else if (uri.getPath() == "/identifier_quote") |
| 28 | #if USE_POCO_SQLODBC || USE_POCO_DATAODBC |
| 29 | return new IdentifierQuoteHandler(keep_alive_timeout, context); |
| 30 | #else |
| 31 | return nullptr; |
| 32 | #endif |
| 33 | else |
| 34 | return new ODBCHandler(pool_map, keep_alive_timeout, context); |
| 35 | } |
| 36 | return nullptr; |
| 37 | } |
| 38 | } |
| 39 |