summaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/restapi/StringResponse.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-core/src/main/java/com/yahoo/restapi/StringResponse.java')
-rw-r--r--container-core/src/main/java/com/yahoo/restapi/StringResponse.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/container-core/src/main/java/com/yahoo/restapi/StringResponse.java b/container-core/src/main/java/com/yahoo/restapi/StringResponse.java
new file mode 100644
index 00000000000..55ea22880de
--- /dev/null
+++ b/container-core/src/main/java/com/yahoo/restapi/StringResponse.java
@@ -0,0 +1,27 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.restapi;
+
+import com.yahoo.container.jdisc.HttpResponse;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
+
+/**
+ * @author bratseth
+ */
+public class StringResponse extends HttpResponse {
+
+ private final String message;
+
+ public StringResponse(String message) {
+ super(200);
+ this.message = message;
+ }
+
+ @Override
+ public void render(OutputStream stream) throws IOException {
+ stream.write(message.getBytes(StandardCharsets.UTF_8));
+ }
+
+}