cn.dreampie.common
接口 Response

所有已知实现类:
AbstractResponse, HttpResponse

public interface Response

Date: 2/6/13 Time: 9:46 PM


方法摘要
 Response addCookie(String cookie, String value)
           
 Response addCookie(String cookie, String value, int expires)
           
 Response clearCookie(String cookie)
           
 Charset getCharset()
          Returns the charset set on this response if any.
 String getHeader(String headerName)
          Returns the value of a header previously set with setHeader().
 OutputStream getOutputStream()
           
 HttpStatus getStatus()
           
 PrintWriter getWriter()
          A writer you can write to to send response as text.
 boolean isClosed()
           
 Response setContentType(String s)
          Sets the content type of this response.
 Response setHeader(String headerName, String header)
           
 Response setStatus(HttpStatus status)
           
<T> T
unwrap(Class<T> clazz)
          Unwraps the underlying native implementation of given class.
 

方法详细信息

getStatus

HttpStatus getStatus()

setStatus

Response setStatus(HttpStatus status)

setContentType

Response setContentType(String s)
Sets the content type of this response.

It is highly recommended to call this before writing the response content, especially if you want to use getWriter().

The response charset may be set when calling this, either to the provided charset in the content type, or by default to UTF-8 if it is a 'text' content type.

参数:
s - the content type
返回:
the current response

getCharset

Charset getCharset()
Returns the charset set on this response if any.

The charset is set when calling setContentType, either to the provided charset in the content type, or by default to UTF-8 if it is a 'text' content type.

返回:
the charset

getWriter

PrintWriter getWriter()
                      throws IOException
A writer you can write to to send response as text.

The charset used is the one returned by getCharset(), or UTF-8 if not set.

It is strongly recommended to call setContentType to set the charset before calling this method.

返回:
a PrintWriter which can be used to write the response.
抛出:
IOException

getOutputStream

OutputStream getOutputStream()
                             throws IOException
抛出:
IOException

addCookie

Response addCookie(String cookie,
                   String value)

addCookie

Response addCookie(String cookie,
                   String value,
                   int expires)

clearCookie

Response clearCookie(String cookie)

setHeader

Response setHeader(String headerName,
                   String header)

getHeader

String getHeader(String headerName)
Returns the value of a header previously set with setHeader().

参数:
headerName - the name of the header to get.
返回:
the header value.

unwrap

<T> T unwrap(Class<T> clazz)
Unwraps the underlying native implementation of given class.

Examnple: This is a HttpServletRequest in a servlet container.

类型参数:
T - unwrapped class
参数:
clazz - the class of the underlying implementation
返回:
the unwrapped implementation.
抛出:
IllegalArgumentException - if the underlying implementation is not of given type.

isClosed

boolean isClosed()


Copyright © 2015. All rights reserved.