diff options
Diffstat (limited to 'container-core/src/main/java/com/yahoo/container/jdisc/LiteralResponse.java')
-rw-r--r-- | container-core/src/main/java/com/yahoo/container/jdisc/LiteralResponse.java | 20 |
1 files changed, 20 insertions, 0 deletions
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)); + } +} |