play.mvc
类 Http.Response

java.lang.Object
  继承者 play.mvc.Http.Response
包容类:
Http

public static class Http.Response
extends java.lang.Object

An HTTP response


字段摘要
 boolean chunked
           
 java.lang.String contentType
          Response content type
 java.util.Map<java.lang.String,Http.Cookie> cookies
          Response cookies
static java.lang.ThreadLocal<Http.Response> current
          Bind to thread
 java.lang.Object direct
          Send this file directly
 java.lang.String encoding
          The encoding used when writing response to client
 java.util.Map<java.lang.String,Http.Header> headers
          Response headers
 java.io.ByteArrayOutputStream out
          Response body stream
 java.lang.Integer status
          Response status code
 
构造方法摘要
Http.Response()
           
 
方法摘要
 void accessControl(java.lang.String allowOrigin)
          Add headers to allow cross-domain requests.
 void accessControl(java.lang.String allowOrigin, boolean allowCredentials)
          Add headers to allow cross-domain requests.
 void accessControl(java.lang.String allowOrigin, java.lang.String allowMethods, boolean allowCredentials)
          Add headers to allow cross-domain requests.
 void cacheFor(java.lang.String duration)
          Add a cache-control header
 void cacheFor(java.lang.String etag, java.lang.String duration, long lastModified)
          Add cache-control headers
static Http.Response current()
          Retrieve the current response
 java.lang.String getHeader(java.lang.String name)
          Get a response header
 void onWriteChunk(F.Action<java.lang.Object> handler)
           
 void print(java.lang.Object o)
           
 void removeCookie(java.lang.String name)
          Removes the specified cookie with path /
 void removeCookie(java.lang.String name, java.lang.String path)
          Removes the cookie
 void reset()
           
 void setContentTypeIfNotSet(java.lang.String contentType)
           
 void setCookie(java.lang.String name, java.lang.String value)
          Set a new cookie
 void setCookie(java.lang.String name, java.lang.String value, java.lang.String duration)
          Set a new cookie that will expire in (current) + duration
 void setCookie(java.lang.String name, java.lang.String value, java.lang.String domain, java.lang.String path, java.lang.Integer maxAge, boolean secure)
           
 void setCookie(java.lang.String name, java.lang.String value, java.lang.String domain, java.lang.String path, java.lang.Integer maxAge, boolean secure, boolean httpOnly)
           
 void setHeader(java.lang.String name, java.lang.String value)
          Set a response header
 void writeChunk(java.lang.Object o)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

status

public java.lang.Integer status
Response status code


contentType

public java.lang.String contentType
Response content type


headers

public java.util.Map<java.lang.String,Http.Header> headers
Response headers


cookies

public java.util.Map<java.lang.String,Http.Cookie> cookies
Response cookies


out

public java.io.ByteArrayOutputStream out
Response body stream


direct

public java.lang.Object direct
Send this file directly


encoding

public java.lang.String encoding
The encoding used when writing response to client


current

public static java.lang.ThreadLocal<Http.Response> current
Bind to thread


chunked

public boolean chunked
构造方法详细信息

Http.Response

public Http.Response()
方法详细信息

current

public static Http.Response current()
Retrieve the current response

返回:
the current response

getHeader

public java.lang.String getHeader(java.lang.String name)
Get a response header

参数:
name - Header name case-insensitive
返回:
the header value as a String

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Set a response header

参数:
name - Header name
value - Header value

setContentTypeIfNotSet

public void setContentTypeIfNotSet(java.lang.String contentType)

setCookie

public void setCookie(java.lang.String name,
                      java.lang.String value)
Set a new cookie

参数:
name - Cookie name
value - Cookie value

removeCookie

public void removeCookie(java.lang.String name)
Removes the specified cookie with path /

参数:
name - cookiename

removeCookie

public void removeCookie(java.lang.String name,
                         java.lang.String path)
Removes the cookie

参数:
name - cookiename
path - cookiepath

setCookie

public void setCookie(java.lang.String name,
                      java.lang.String value,
                      java.lang.String duration)
Set a new cookie that will expire in (current) + duration

参数:
name -
value -
duration - Ex: 3d

setCookie

public void setCookie(java.lang.String name,
                      java.lang.String value,
                      java.lang.String domain,
                      java.lang.String path,
                      java.lang.Integer maxAge,
                      boolean secure)

setCookie

public void setCookie(java.lang.String name,
                      java.lang.String value,
                      java.lang.String domain,
                      java.lang.String path,
                      java.lang.Integer maxAge,
                      boolean secure,
                      boolean httpOnly)

cacheFor

public void cacheFor(java.lang.String duration)
Add a cache-control header

参数:
duration - Ex: 3h

cacheFor

public void cacheFor(java.lang.String etag,
                     java.lang.String duration,
                     long lastModified)
Add cache-control headers

参数:
duration - Ex: 3h

accessControl

public void accessControl(java.lang.String allowOrigin)
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.

参数:
allowOrigin - a comma separated list of domains allowed to perform the x-domain call, or "*" for all.

accessControl

public void accessControl(java.lang.String allowOrigin,
                          boolean allowCredentials)
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.

参数:
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 != "*"

accessControl

public void accessControl(java.lang.String allowOrigin,
                          java.lang.String allowMethods,
                          boolean allowCredentials)
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.

参数:
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 != "*"

print

public void print(java.lang.Object o)

reset

public void reset()

writeChunk

public void writeChunk(java.lang.Object o)

onWriteChunk

public void onWriteChunk(F.Action<java.lang.Object> handler)


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly