blob: 9b7c491940353c7e9f75e841d31f650d02c065fd (
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
50
51
52
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "htmlstatusreporter.h"
namespace storage::framework {
HtmlStatusReporter::HtmlStatusReporter(vespalib::stringref id,
vespalib::stringref name)
: StatusReporter(id, name)
{
}
HtmlStatusReporter::~HtmlStatusReporter() = default;
void
HtmlStatusReporter::reportHtmlHeader(std::ostream& out,
const HttpUrlPath& path) const
{
out << "<html>\n"
<< "<head>\n"
<< " <title>" << getName() << "</title>\n";
reportHtmlHeaderAdditions(out, path);
out << "</head>\n"
<< "<body>\n"
<< " <h1>" << getName() << "</h1>\n";
}
void
HtmlStatusReporter::reportHtmlFooter(std::ostream& out,
const HttpUrlPath&) const
{
out << "</body>\n</html>\n";
}
vespalib::string
HtmlStatusReporter::getReportContentType(const HttpUrlPath&) const
{
return "text/html";
}
bool
HtmlStatusReporter::reportStatus(std::ostream& out,
const HttpUrlPath& path) const
{
if (!isValidStatusRequest()) return false;
reportHtmlHeader(out, path);
reportHtmlStatus(out, path);
reportHtmlFooter(out, path);
return true;
}
}
|