public class Body extends Object
class MyRoute { @GET @Path("/") public Body webMethod() { return Body.redirect("/somewhere") } }
Modifier and Type | Class and Description |
---|---|
static interface |
Body.Formatter |
static interface |
Body.Parser |
static interface |
Body.Reader
Utility class to properly reading a HTTP request body or parameters.
|
static interface |
Body.Writer
Utility class to properly write data into the HTTP response body.
|
Modifier and Type | Method and Description |
---|---|
static Body |
accepted() |
static Body |
accepted(Object content) |
static Body |
body(int status)
Set the response status.
|
static Body |
body(Object content)
Set the body content!
|
static Body |
body(Status status)
Set the response status.
|
Optional<Object> |
content() |
Body |
content(Object content)
Set body content.
|
Body |
header(String name,
byte value)
Sets a response header with the given name and value.
|
Body |
header(String name,
char value)
Sets a response header with the given name and value.
|
Body |
header(String name,
CharSequence value)
Sets a response header with the given name and value.
|
Body |
header(String name,
Date value)
Sets a response header with the given name and value.
|
Body |
header(String name,
double value)
Sets a response header with the given name and value.
|
Body |
header(String name,
float value)
Sets a response header with the given name and value.
|
Body |
header(String name,
int value)
Sets a response header with the given name and value.
|
Body |
header(String name,
long value)
Sets a response header with the given name and value.
|
Body |
header(String name,
short value)
Sets a response header with the given name and value.
|
Map<String,String> |
headers() |
static Body |
moved(String location)
Produces a redirect (302) status code and set the
Location header too. |
static Body |
noContent() |
static Body |
ok() |
static Body |
ok(Object content) |
static Body |
redirect(String location)
Produces a redirect (302) status code and set the
Location header too. |
static Body |
seeOther(String location)
Produces a redirect (302) status code and set the
Location header too. |
Optional<Status> |
status() |
Body |
status(int status)
Set response status.
|
Body |
status(Status status)
Set response status.
|
static Body |
tempRedirect(String location)
Produces a redirect (307) status code and set the
Location header too. |
Optional<MediaType> |
type() |
Body |
type(MediaType type)
Set the content type of this body.
|
Body |
type(String type)
Set the content type of this body.
|
@Nonnull public static Body body(@Nonnull Object content)
content
- A content.@Nonnull public static Body body(@Nonnull Status status)
status
- A status!@Nonnull public static Body body(@Nonnull int status)
status
- A status!@Nonnull public static Body ok(@Nonnull Object content)
content
- A body content!Status.OK
and given content.@Nonnull public static Body accepted()
Status.ACCEPTED
.@Nonnull public static Body accepted(@Nonnull Object content)
content
- A body content!Status.ACCEPTED
.@Nonnull public static Body noContent()
Status.NO_CONTENT
.@Nonnull public static Body redirect(@Nonnull String location)
Location
header too.location
- A location.@Nonnull public static Body tempRedirect(@Nonnull String location)
Location
header too.location
- A location.@Nonnull public static Body moved(@Nonnull String location)
Location
header too.location
- A location.@Nonnull public static Body seeOther(@Nonnull String location)
Location
header too.location
- A location.@Nonnull public Body status(@Nonnull Status status)
status
- A new response status to use.@Nonnull public Body status(int status)
status
- A new response status to use.@Nonnull public Body type(@Nonnull MediaType type)
type
- A content type.@Nonnull public Body type(@Nonnull String type)
type
- A content type.@Nonnull public Body content(@Nonnull Object content)
content
- A body!@Nonnull public Body header(@Nonnull String name, char value)
name
- Header's name.value
- Header's value.@Nonnull public Body header(@Nonnull String name, byte value)
name
- Header's name.value
- Header's value.@Nonnull public Body header(@Nonnull String name, short value)
name
- Header's name.value
- Header's value.@Nonnull public Body header(@Nonnull String name, int value)
name
- Header's name.value
- Header's value.public Body header(String name, long value)
name
- Header's name.value
- Header's value.@Nonnull public Body header(@Nonnull String name, float value)
name
- Header's name.value
- Header's value.@Nonnull public Body header(@Nonnull String name, double value)
name
- Header's name.value
- Header's value.@Nonnull public Body header(@Nonnull String name, CharSequence value)
name
- Header's name.value
- Header's value.Copyright © 2014. All rights reserved.