Package org.takes.rs
Class RsWithBody
- java.lang.Object
-
- org.takes.rs.RsWrap
-
- org.takes.rs.RsWithBody
-
public final class RsWithBody extends RsWrap
Response decorator, with body.This implementation of the
Response
interface requires that theHead.head()
method has to be invoked before reading from theInputStream
obtained from theBody.body()
method.The class is immutable and thread-safe.
- Since:
- 0.1
-
-
Constructor Summary
Constructors Constructor Description RsWithBody(byte[] body)
Constructs aRsWithBody
with the specified body.RsWithBody(InputStream body)
Constructs aRsWithBody
with the specified body.RsWithBody(CharSequence body)
Constructs aRsWithBody
with the specified body that will be encoded into UTF-8 by default.RsWithBody(URL url)
Constructs aRsWithBody
with the content located at the specified url as body.RsWithBody(Response res, byte[] body)
Ctor.RsWithBody(Response res, InputStream body)
Ctor.RsWithBody(Response res, CharSequence body)
Constructs aRsWithBody
with the specified response and body.RsWithBody(Response res, CharSequence body, Charset charset)
Constructs aRsWithBody
with the specified response and body.RsWithBody(Response res, URL url)
Ctor.
-
-
-
Constructor Detail
-
RsWithBody
public RsWithBody(CharSequence body)
Constructs aRsWithBody
with the specified body that will be encoded into UTF-8 by default.- Parameters:
body
- Body
-
RsWithBody
public RsWithBody(byte[] body)
Constructs aRsWithBody
with the specified body.- Parameters:
body
- Body
-
RsWithBody
public RsWithBody(InputStream body)
Constructs aRsWithBody
with the specified body.- Parameters:
body
- Body
-
RsWithBody
public RsWithBody(URL url)
Constructs aRsWithBody
with the content located at the specified url as body.- Parameters:
url
- URL with body
-
RsWithBody
public RsWithBody(Response res, CharSequence body)
Constructs aRsWithBody
with the specified response and body. The body will be encoded into UTF-8 by default.- Parameters:
res
- Original responsebody
- Body
-
RsWithBody
public RsWithBody(Response res, CharSequence body, Charset charset)
Constructs aRsWithBody
with the specified response and body. The body will be encoded using the specified character set.- Parameters:
res
- Original responsebody
- Bodycharset
- The character set to use to serialize the body
-
RsWithBody
public RsWithBody(Response res, URL url)
Ctor.- Parameters:
res
- Original responseurl
- URL with body
-
RsWithBody
public RsWithBody(Response res, byte[] body)
Ctor.- Parameters:
res
- Original responsebody
- Body
-
RsWithBody
public RsWithBody(Response res, InputStream body)
Ctor.- Parameters:
res
- Original responsebody
- Body
-
-