aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/pages/resource_mon_page.cpp
blob: ec4ac6a1a7303c5f18980734ac3d1328090fb191 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "resource_mon_page.h"

using namespace NMonitoring;

void TResourceMonPage::Output(NMonitoring::IMonHttpRequest& request) {
    IOutputStream& out = request.Output();
    switch (ResourceType) {
        case TEXT:
            out << HTTPOKTEXT;
            break;
        case JSON:
            out << HTTPOKJSON;
            break;
        case CSS:
            out << HTTPOKCSS;
            break;
        case JAVASCRIPT:
            out << HTTPOKJAVASCRIPT;
            break;
        case FONT_EOT:
            out << HTTPOKFONTEOT;
            break;
        case FONT_TTF:
            out << HTTPOKFONTTTF;
            break;
        case FONT_WOFF:
            out << HTTPOKFONTWOFF;
            break;
        case FONT_WOFF2:
            out << HTTPOKFONTWOFF2;
            break;
        case PNG:
            out << HTTPOKPNG;
            break;
        case SVG:
            out << HTTPOKSVG;
            break;
        default:
            out << HTTPOKBIN;
            break;
    }
    out << NResource::Find(ResourceName);
}

void TResourceMonPage::NotFound(NMonitoring::IMonHttpRequest& request) const {
    IOutputStream& out = request.Output();
    out << HTTPNOTFOUND;
    out.Flush();
}