public interface Response
Response
interface is an abstraction of a HTTP
response, that consists of a few headers and a body. To construct
a response, use one of the composable decorators from
org.takes.rs
package. For example, this code will create
a response with HTML inside:
final Response response = new RsWithHeader( new RsWithBody( new RsWithStatus(200), "hello, world!" ), "Content-Type", "text/html" );
The implementations of this interface may require that
head()
method has to be invoked before reading from the
InputStream
obtained from the body()
method,
but they must NOT require that the InputStream
has to be read
from before the head()
method invocation.
All implementations of this interface must be immutable and thread-safe.
Take
,
RsWithBody
,
RsWithHeader
,
Composable Decorators vs. Imperative Utility MethodsModifier and Type | Method and Description |
---|---|
InputStream |
body()
HTTP response body.
|
Iterable<String> |
head()
HTTP response head.
|
Iterable<String> head() throws IOException
IOException
- If something goes wrongInputStream body() throws IOException
IOException
- If something goes wrongCopyright © 2015–2018 Take. All rights reserved.