blob: 7aa6bd326c41ed49991fe772b315e7093268ade5 (
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
|
// Copyright Vespa.ai. 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;
}
}
|