aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/pages/resource_mon_page.cpp
blob: c1e52bccf34766cd2789ccdcac8f7fb5d1f4b848 (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 << (IsCached ? HTTPOKCSS_CACHED : HTTPOKCSS);
            break;
        case JAVASCRIPT:
            out << (IsCached ? HTTPOKJAVASCRIPT_CACHED : HTTPOKJAVASCRIPT);
            break;
        case FONT_EOT:
            out << (IsCached ? HTTPOKFONTEOT_CACHED : HTTPOKFONTEOT);
            break;
        case FONT_TTF:
            out << (IsCached ? HTTPOKFONTTTF_CACHED : HTTPOKFONTTTF);
            break;
        case FONT_WOFF:
            out << (IsCached ? HTTPOKFONTWOFF_CACHED : HTTPOKFONTWOFF);
            break;
        case FONT_WOFF2:
            out << (IsCached ? HTTPOKFONTWOFF2_CACHED : 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();
}