public class Result
extends java.lang.Object
Constructor and Description |
---|
Result(int status)
Create a result with no entity.
|
Result(int status,
HttpEntity body)
Create a result.
|
Result(int status,
java.util.Map<java.lang.String,java.lang.String> headers)
Create a result with no body.
|
Result(int status,
java.util.Map<java.lang.String,java.lang.String> headers,
HttpEntity body)
Create a result.
|
Result(int status,
java.util.Optional<java.lang.String> reasonPhrase,
java.util.Map<java.lang.String,java.lang.String> headers,
HttpEntity body)
Deprecated.
Deprecated as of 2.6.0. Use
Result(int, String, Map, HttpEntity) . |
Result(int status,
java.lang.String reasonPhrase,
java.util.Map<java.lang.String,java.lang.String> headers,
HttpEntity body)
Create a result.
|
Result(ResponseHeader header,
HttpEntity body)
Create a result from a Scala ResponseHeader and a body.
|
Result(ResponseHeader header,
HttpEntity body,
Http.Session session,
Http.Flash flash,
java.util.List<Http.Cookie> cookies)
Create a result from a Scala ResponseHeader and a body.
|
Modifier and Type | Method and Description |
---|---|
Result |
as(java.lang.String contentType)
Return a copy of the result with a different Content-Type header.
|
play.api.mvc.Result |
asScala()
Convert this result to a Scala result.
|
HttpEntity |
body()
Get the body of this result.
|
java.util.Optional<java.lang.String> |
charset()
Extracts the Charset of this Result value.
|
java.util.Optional<java.lang.String> |
contentType()
Extracts the Content-Type of this Result value.
|
Http.Cookie |
cookie(java.lang.String name)
Extracts a Cookie value from this Result value
|
Http.Cookies |
cookies()
Extracts the Cookies (an iterator) from this result value.
|
Http.Flash |
flash()
Extracts the Flash values of this Result value.
|
protected ResponseHeader |
getHeader()
Get the response header
|
protected play.api.mvc.ResponseHeader |
header()
Deprecated.
Deprecated as in 2.6.0. Use
getHeader() |
java.util.Optional<java.lang.String> |
header(java.lang.String header)
Extracts an Header value of this Result value.
|
java.util.Map<java.lang.String,java.lang.String> |
headers()
Extracts all Headers of this Result value.
|
java.util.Optional<java.lang.String> |
reasonPhrase()
Get the reason phrase, if it was set.
|
java.util.Optional<java.lang.String> |
redirectLocation()
Extracts the Location header of this Result value if this Result is a Redirect.
|
Http.Session |
session()
Extracts the Session of this Result value.
|
int |
status()
Get the status.
|
Result |
withCookies(Http.Cookie... newCookies)
Returns a copy of this result with the given cookies.
|
Result |
withHeader(java.lang.String name,
java.lang.String value)
Return a copy of this result with the given header.
|
Result |
withHeaders(java.lang.String... nameValues)
Return a copy of this result with the given headers.
|
public Result(ResponseHeader header, HttpEntity body, Http.Session session, Http.Flash flash, java.util.List<Http.Cookie> cookies)
header
- the response headerbody
- the response body.session
- the session set on the response.flash
- the flash object on the response.cookies
- the cookies set on the response.public Result(ResponseHeader header, HttpEntity body)
header
- the response headerbody
- the response body.@Deprecated public Result(int status, java.util.Optional<java.lang.String> reasonPhrase, java.util.Map<java.lang.String,java.lang.String> headers, HttpEntity body)
Result(int, String, Map, HttpEntity)
.status
- The status.reasonPhrase
- The reason phrase, if a non default reason phrase is required.headers
- The headers.body
- The body.public Result(int status, java.lang.String reasonPhrase, java.util.Map<java.lang.String,java.lang.String> headers, HttpEntity body)
status
- The status.reasonPhrase
- The reason phrase, if a non default reason phrase is required.headers
- The headers.body
- The body.public Result(int status, java.util.Map<java.lang.String,java.lang.String> headers, HttpEntity body)
status
- The status.headers
- The headers.body
- The body.public Result(int status, java.util.Map<java.lang.String,java.lang.String> headers)
status
- The status.headers
- The headers.public Result(int status, HttpEntity body)
status
- The status.body
- The entity.public Result(int status)
status
- The status.public int status()
public java.util.Optional<java.lang.String> reasonPhrase()
@Deprecated protected play.api.mvc.ResponseHeader header()
getHeader()
ResponseHeader
protected ResponseHeader getHeader()
public HttpEntity body()
public java.util.Optional<java.lang.String> redirectLocation()
public java.util.Optional<java.lang.String> header(java.lang.String header)
header
- the header name.public java.util.Map<java.lang.String,java.lang.String> headers()
public java.util.Optional<java.lang.String> contentType()
public java.util.Optional<java.lang.String> charset()
public Http.Flash flash()
public Http.Session session()
public Http.Cookie cookie(java.lang.String name)
name
- the cookie's name.public Http.Cookies cookies()
public Result withCookies(Http.Cookie... newCookies)
newCookies
- the cookies to add to the result.public Result withHeader(java.lang.String name, java.lang.String value)
name
- the header namevalue
- the header valuepublic Result withHeaders(java.lang.String... nameValues)
nameValues
- the array of names and values.public Result as(java.lang.String contentType)
contentType
- the content type to setpublic play.api.mvc.Result asScala()