1#include "NotFoundHandler.h"
2
3#include <IO/HTTPCommon.h>
4
5#include <Common/Exception.h>
6
7#include <Poco/Net/HTTPServerRequest.h>
8#include <Poco/Net/HTTPServerResponse.h>
9
10namespace DB
11{
12
13void NotFoundHandler::handleRequest(
14 Poco::Net::HTTPServerRequest & request,
15 Poco::Net::HTTPServerResponse & response)
16{
17 try
18 {
19 response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_NOT_FOUND);
20 response.send() << "There is no handle " << request.getURI() << "\n\n"
21 << "Use / or /ping for health checks.\n"
22 << "Or /replicas_status for more sophisticated health checks.\n\n"
23 << "Send queries from your program with POST method or GET /?query=...\n\n"
24 << "Use clickhouse-client:\n\n"
25 << "For interactive data analysis:\n"
26 << " clickhouse-client\n\n"
27 << "For batch query processing:\n"
28 << " clickhouse-client --query='SELECT 1' > result\n"
29 << " clickhouse-client < query > result\n";
30 }
31 catch (...)
32 {
33 tryLogCurrentException("NotFoundHandler");
34 }
35}
36
37}
38