summaryrefslogtreecommitdiffstats
path: root/container-core
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahoo-inc.com>2017-02-09 08:53:25 +0100
committerHåkon Hallingstad <hakon@yahoo-inc.com>2017-02-09 08:53:25 +0100
commit084ac886ddd29eef26798c5d3854c4647bf5eb73 (patch)
treefd08f63030ab05db52ad8211e8c22890da1d69e9 /container-core
parent27ddf647d881ab58ae69dd629599b52ee7c9d320 (diff)
Adds Config Server application handler for Cluster Controller status page
Diffstat (limited to 'container-core')
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/HttpResponse.java2
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/LiteralResponse.java20
2 files changed, 21 insertions, 1 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/HttpResponse.java b/container-core/src/main/java/com/yahoo/container/jdisc/HttpResponse.java
index 1b089930482..20f904efb9b 100644
--- a/container-core/src/main/java/com/yahoo/container/jdisc/HttpResponse.java
+++ b/container-core/src/main/java/com/yahoo/container/jdisc/HttpResponse.java
@@ -42,7 +42,7 @@ public abstract class HttpResponse {
}
/**
- * Marshal this response to the network layer.
+ * Marshal this response to the network layer. The caller is responsible for flushing and closing outputStream.
*/
public abstract void render(OutputStream outputStream) throws IOException;
diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/LiteralResponse.java b/container-core/src/main/java/com/yahoo/container/jdisc/LiteralResponse.java
new file mode 100644
index 00000000000..c923c0ce0a5
--- /dev/null
+++ b/container-core/src/main/java/com/yahoo/container/jdisc/LiteralResponse.java
@@ -0,0 +1,20 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.container.jdisc;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
+
+public class LiteralResponse extends HttpResponse {
+ private final String body;
+
+ public LiteralResponse(int code, String body) {
+ super(code);
+ this.body = body;
+ }
+
+ @Override
+ public void render(OutputStream outputStream) throws IOException {
+ outputStream.write(body.getBytes(StandardCharsets.UTF_8));
+ }
+}