aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Server/StaticRequestHandler.h
blob: df9374d440968c8d657ef7bd3f9f82fa5097726f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include <Server/HTTP/HTTPRequestHandler.h>
#include <base/types.h>


namespace DB
{

class IServer;
class WriteBuffer;

/// Response with custom string. Can be used for browser.
class StaticRequestHandler : public HTTPRequestHandler
{
private:
    IServer & server;

    int status;
    String content_type;
    String response_expression;

public:
    StaticRequestHandler(
        IServer & server,
        const String & expression,
        int status_ = 200,
        const String & content_type_ = "text/html; charset=UTF-8");

    void writeResponse(WriteBuffer & out);

    void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response) override;
};

}