2020-04-04 08:57:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "IServer.h"
|
|
|
|
|
|
|
|
#include <Poco/Net/HTTPRequestHandler.h>
|
|
|
|
#include <Common/StringUtils/StringUtils.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Response with custom string. Can be used for browser.
|
|
|
|
class StaticRequestHandler : public Poco::Net::HTTPRequestHandler
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
IServer & server;
|
|
|
|
|
|
|
|
int status;
|
|
|
|
String content_type;
|
2020-04-26 11:06:14 +00:00
|
|
|
String response_expression;
|
2020-04-04 08:57:16 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
StaticRequestHandler(IServer & server, const String & expression, int status_ = 200, const String & content_type_ = "text/html; charset=UTF-8");
|
|
|
|
|
2020-04-26 11:06:14 +00:00
|
|
|
void writeResponse(WriteBuffer & out);
|
|
|
|
|
2020-04-04 08:57:16 +00:00
|
|
|
void handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|