|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectplay.mvc.Http.Response
public static class Http.Response
An HTTP response
| Field Summary | |
|---|---|
String |
contentType
Response content type |
Map<String,Http.Cookie> |
cookies
Response cookies |
static ThreadLocal<Http.Response> |
current
Bind to thread |
Object |
direct
Send this file directly |
Map<String,Http.Header> |
headers
Response headers |
ByteArrayOutputStream |
out
Response body stream |
Integer |
status
Response status code |
| Constructor Summary | |
|---|---|
Http.Response()
|
|
| Method Summary | |
|---|---|
void |
accessControl(String allowOrigin)
Add headers to allow cross-domain requests. |
void |
accessControl(String allowOrigin,
boolean allowCredentials)
Add headers to allow cross-domain requests. |
void |
accessControl(String allowOrigin,
String allowMethods,
boolean allowCredentials)
Add headers to allow cross-domain requests. |
void |
cacheFor(String duration)
Add a cache-control header |
void |
cacheFor(String etag,
String duration,
long lastModified)
Add cache-control headers |
static Http.Response |
current()
Retrieve the current response |
String |
getHeader(String name)
Get a response header |
void |
print(Object o)
|
void |
removeCookie(String name)
|
void |
reset()
|
void |
setCookie(String name,
String value)
Set a new cookie |
void |
setCookie(String name,
String value,
Integer maxAge)
|
void |
setCookie(String name,
String value,
String duration)
Set a new cookie that will expire in (current) + duration |
void |
setCookie(String name,
String value,
String domain,
String path,
Integer maxAge)
|
void |
setCookie(String name,
String value,
String domain,
String path,
String duration)
|
void |
setHeader(String name,
String value)
Set a response header |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public Integer status
public String contentType
public Map<String,Http.Header> headers
public Map<String,Http.Cookie> cookies
public ByteArrayOutputStream out
public Object direct
public static ThreadLocal<Http.Response> current
| Constructor Detail |
|---|
public Http.Response()
| Method Detail |
|---|
public static Http.Response current()
public String getHeader(String name)
name - Header name case-insensitive
public void setHeader(String name,
String value)
name - Header namevalue - Header value
public void setCookie(String name,
String value)
name - Cookie namevalue - Cookie valuepublic void removeCookie(String name)
public void setCookie(String name,
String value,
String duration)
name - value - duration - Ex: 3d
public void setCookie(String name,
String value,
Integer maxAge)
public void setCookie(String name,
String value,
String domain,
String path,
String duration)
public void setCookie(String name,
String value,
String domain,
String path,
Integer maxAge)
public void cacheFor(String duration)
duration - Ex: 3h
public void cacheFor(String etag,
String duration,
long lastModified)
duration - Ex: 3hpublic void accessControl(String allowOrigin)
allowOrigin - a comma separated list of domains allowed to perform the x-domain call, or "*" for all.
public void accessControl(String allowOrigin,
boolean allowCredentials)
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 a x-domain request. Only respected by the browser if allowOrigin != "*"
public void accessControl(String allowOrigin,
String allowMethods,
boolean allowCredentials)
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 a x-domain request. Only respected by the browser if allowOrigin != "*"public void print(Object o)
public void reset()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||