Package play.mvc
Class Http.Response
java.lang.Object
play.mvc.Http.Response
- Enclosing class:
- Http
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccessControl(String allowOrigin) Add headers to allow cross-domain requests.voidaccessControl(String allowOrigin, boolean allowCredentials) Add headers to allow cross-domain requests.voidaccessControl(String allowOrigin, String allowMethods, boolean allowCredentials) Add headers to allow cross-domain requests.voidAdd a cache-control headervoidAdd cache-control headersstatic Http.Responsecurrent()Deprecated.@Nullable StringGet a response headervoidonWriteChunk(Consumer<Object> handler) voidvoidremoveCookie(String name) voidremoveCookie(String name, String path) static voidvoidsetContentTypeIfNotSet(String contentType) voidvoidSet a new cookie that will expire in (current) + durationvoidvoidsetCookie(String name, String value, String domain, String path, Integer maxAge, boolean secure, boolean httpOnly) static voidsetCurrent(Http.Response response) Deprecated.voidvoidwriteChunk(Object o)
-
Field Details
-
status
public int status -
contentType
-
headers
-
cookies
-
out
-
direct
-
encoding
-
chunked
public boolean chunked
-
-
Constructor Details
-
Response
public Response()
-
-
Method Details
-
current
Deprecated. -
setCurrent
Deprecated. -
removeCurrent
public static void removeCurrent() -
getHeader
Get a response header- Parameters:
name- Header name case-insensitive- Returns:
- the header value as a String
-
setHeader
-
setContentTypeIfNotSet
-
setCookie
-
removeCookie
-
removeCookie
-
setCookie
Set a new cookie that will expire in (current) + duration- Parameters:
duration- the cookie duration (Ex: "3d")
-
setCookie
-
setCookie
-
cacheFor
Add a cache-control header- Parameters:
duration- Ex: 3h
-
cacheFor
Add cache-control headers- Parameters:
eTag- the Etag valueduration- the cache duration (Ex: 3h)lastModified- The last modified date
-
accessControl
Add headers to allow cross-domain requests. Be careful, a lot of browsers don't support these features and will ignore the headers. Refer to the browsers' documentation to know what versions support them.- Parameters:
allowOrigin- a comma separated list of domains allowed to perform the x-domain call, or "*" for all.
-
accessControl
Add headers to allow cross-domain requests. Be careful, a lot of browsers don't support these features and will ignore the headers. Refer to the browsers' documentation to know what versions support them.- Parameters:
allowOrigin- a comma separated list of domains allowed to perform the x-domain call, or "*" for all.allowCredentials- Let the browser send the cookies when doing an x-domain request. Only respected by the browser if allowOrigin != "*"
-
accessControl
Add headers to allow cross-domain requests. Be careful, a lot of browsers don't support these features and will ignore the headers. Refer to the browsers' documentation to know what versions support them.- Parameters:
allowOrigin- a comma separated list of domains allowed to perform the x-domain call, or "*" for all.allowMethods- a comma separated list of HTTP methods allowed, or null for all.allowCredentials- Let the browser send the cookies when doing an x-domain request. Only respected by the browser if allowOrigin != "*"
-
print
-
writeChunk
-
onWriteChunk
-