aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp')
-rw-r--r--storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp b/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp
new file mode 100644
index 00000000000..9b7c4919403
--- /dev/null
+++ b/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp
@@ -0,0 +1,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;
+}
+
+}