2018-08-08 16:15:29 +00:00
|
|
|
#include "HandlerFactory.h"
|
2018-08-19 17:09:54 +00:00
|
|
|
#include "PingHandler.h"
|
|
|
|
#include "ColumnInfoHandler.h"
|
2018-09-14 19:48:51 +00:00
|
|
|
#include <Poco/URI.h>
|
2018-08-08 16:15:29 +00:00
|
|
|
#include <Poco/Ext/SessionPoolHelpers.h>
|
|
|
|
#include <Poco/Net/HTTPServerRequest.h>
|
|
|
|
#include <common/logger_useful.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
Poco::Net::HTTPRequestHandler * HandlerFactory::createRequestHandler(const Poco::Net::HTTPServerRequest & request)
|
|
|
|
{
|
2018-08-19 17:09:54 +00:00
|
|
|
Poco::URI uri{request.getURI()};
|
|
|
|
LOG_TRACE(log, "Request URI: " + uri.toString());
|
2018-08-08 16:15:29 +00:00
|
|
|
|
2018-08-19 17:09:54 +00:00
|
|
|
if (uri.getPath() == "/ping" && request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET)
|
2018-08-08 16:15:29 +00:00
|
|
|
return new PingHandler(keep_alive_timeout);
|
|
|
|
|
|
|
|
if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST)
|
2018-08-19 17:09:54 +00:00
|
|
|
{
|
2018-08-08 16:15:29 +00:00
|
|
|
|
2018-08-19 20:18:31 +00:00
|
|
|
if (uri.getPath() == "/columns_info")
|
2018-08-19 17:09:54 +00:00
|
|
|
#if USE_POCO_SQLODBC || USE_POCO_DATAODBC
|
|
|
|
return new ODBCColumnsInfoHandler(keep_alive_timeout, context);
|
|
|
|
#else
|
|
|
|
return nullptr;
|
2018-09-27 15:23:42 +00:00
|
|
|
#endif
|
|
|
|
else if(uri.getPath() == "/identifier_quote")
|
|
|
|
#if USE_POCO_SQLODBC || USE_POCO_DATAODBC
|
|
|
|
return new IdentifierQuoteHandler(keep_alive_timeout, context);
|
|
|
|
#else
|
|
|
|
return nullptr;
|
2018-08-19 17:09:54 +00:00
|
|
|
#endif
|
|
|
|
else
|
|
|
|
return new ODBCHandler(pool_map, keep_alive_timeout, context);
|
|
|
|
}
|
2018-08-08 16:15:29 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|