PHP 클래스 AppserverIo\Appserver\ServletEngine\Http\Response

상속: implements AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface
파일 보기 프로젝트 열기: appserver-io/appserver 1 사용 예제들

공개 메소드들

메소드 설명
addCookie ( AppserverIo\Psr\HttpMessage\CookieInterface $cookie ) : void Adds a cookie.
addHeader ( string $name, string $value, boolean $append = false ) : void Adds a header information got from connection. We've to take care that headers like Set-Cookie header can exist multiple times. To support this create an array that keeps the multiple header values.
appendBodyStream ( string $content ) : void Appends the content.
copyBodyStream ( resource $sourceStream, integer $maxlength = null, integer $offset ) : integer Copies a source stream to body stream.
getBodyContent ( ) : string Return content
getBodyStream ( ) : resource Returns the body stream as a resource.
getCookie ( string $cookieName ) : mixed Returns the cookie with the a cookie
getCookies ( ) : array Returns the cookies.
getException ( ) : Exception | null Returns the exception bound to the response.
getHeader ( string $name ) : mixed Returns header by given name.
getHeaders ( ) : array Returns all headers as array
getHeadersAsString ( ) : string Returns the headers as string
getState ( ) : integer Returns the current state
getStatusCode ( ) : integer Returns the response status code
getStatusReasonPhrase ( ) : string Returns the status phrase based on the status code
getVersion ( ) : string Returns the http version of the response
hasCookie ( string $cookieName ) : boolean Returns TRUE if the response already has a cookie with the passed name, else FALSE.
hasException ( ) : boolean Queries whether the response contains an exception or not.
hasHeader ( string $name ) : boolean Check's if header exists by given name
hasState ( integer $state ) : boolean Compares current state with given state
init ( ) : void Initialises the response object to default properties.
redirect ( string $url, integer $code = 301 ) : void Redirects to the passed URL by adding a 'Location' header and setting the appropriate status code, by default 301.
removeHeader ( string $name ) : void Removes the header with the passed name.
resetBodyStream ( ) : void Reset the body stream
setBodyStream ( resource $bodyStream ) : void Resetss the stream resource pointing to body content.
setException ( Exception $exception ) : void Binds the exception to the response.
setHeaders ( array $headers ) : void Resets all headers by given array
setState ( integer $state ) : void Sets state of response
setStatusCode ( integer $code ) : void Sets the http response status code
setStatusReasonPhrase ( string $statusReasonPhrase ) : void Sets the status reason phrase

보호된 메소드들

메소드 설명
initDefaultHeaders ( ) : void Initializes the response with the default headers.

메소드 상세

addCookie() 공개 메소드

Adds a cookie.
public addCookie ( AppserverIo\Psr\HttpMessage\CookieInterface $cookie ) : void
$cookie AppserverIo\Psr\HttpMessage\CookieInterface The cookie instance to add
리턴 void

addHeader() 공개 메소드

Adds a header information got from connection. We've to take care that headers like Set-Cookie header can exist multiple times. To support this create an array that keeps the multiple header values.
public addHeader ( string $name, string $value, boolean $append = false ) : void
$name string The header name
$value string The headers value
$append boolean If TRUE and a header with the passed name already exists, the value will be appended
리턴 void

appendBodyStream() 공개 메소드

Appends the content.
public appendBodyStream ( string $content ) : void
$content string The content to append
리턴 void

copyBodyStream() 공개 메소드

Copies a source stream to body stream.
public copyBodyStream ( resource $sourceStream, integer $maxlength = null, integer $offset ) : integer
$sourceStream resource The file pointer to source stream
$maxlength integer The max length to read from source stream
$offset integer The offset from source stream to read
리턴 integer The total number of bytes copied

getBodyContent() 공개 메소드

Return content
public getBodyContent ( ) : string
리턴 string $content

getBodyStream() 공개 메소드

Returns the body stream as a resource.
public getBodyStream ( ) : resource
리턴 resource The body stream

getCookie() 공개 메소드

Returns the cookie with the a cookie
public getCookie ( string $cookieName ) : mixed
$cookieName string Name of the cookie to be checked
리턴 mixed The cookie instance or an array of cookie instances

getCookies() 공개 메소드

Returns the cookies.
public getCookies ( ) : array
리턴 array The cookies

getException() 공개 메소드

Returns the exception bound to the response.
public getException ( ) : Exception | null
리턴 Exception | null The exception

getHeader() 공개 메소드

Returns header by given name.
public getHeader ( string $name ) : mixed
$name string The header name to get
리턴 mixed Usually a string, but can also be an array if we request the Set-Cookie header

getHeaders() 공개 메소드

Returns all headers as array
public getHeaders ( ) : array
리턴 array

getHeadersAsString() 공개 메소드

Returns the headers as string
public getHeadersAsString ( ) : string
리턴 string

getState() 공개 메소드

Returns the current state
public getState ( ) : integer
리턴 integer

getStatusCode() 공개 메소드

Returns the response status code
public getStatusCode ( ) : integer
리턴 integer

getStatusReasonPhrase() 공개 메소드

Returns the status phrase based on the status code
public getStatusReasonPhrase ( ) : string
리턴 string

getVersion() 공개 메소드

Returns the http version of the response
public getVersion ( ) : string
리턴 string

hasCookie() 공개 메소드

Returns TRUE if the response already has a cookie with the passed name, else FALSE.
public hasCookie ( string $cookieName ) : boolean
$cookieName string Name of the cookie to be checked
리턴 boolean TRUE if the response already has the cookie, else FALSE

hasException() 공개 메소드

Queries whether the response contains an exception or not.
public hasException ( ) : boolean
리턴 boolean TRUE if an exception has been attached, else FALSE

hasHeader() 공개 메소드

Check's if header exists by given name
public hasHeader ( string $name ) : boolean
$name string The header name to check
리턴 boolean

hasState() 공개 메소드

Compares current state with given state
public hasState ( integer $state ) : boolean
$state integer The state to compare with
리턴 boolean Whether state is equal (true) or not (false)

init() 공개 메소드

Initialises the response object to default properties.
public init ( ) : void
리턴 void

initDefaultHeaders() 보호된 메소드

Initializes the response with the default headers.
protected initDefaultHeaders ( ) : void
리턴 void

redirect() 공개 메소드

Redirects to the passed URL by adding a 'Location' header and setting the appropriate status code, by default 301.
public redirect ( string $url, integer $code = 301 ) : void
$url string The URL to forward to
$code integer The status code to set
리턴 void

removeHeader() 공개 메소드

Removes the header with the passed name.
public removeHeader ( string $name ) : void
$name string Name of the header to remove
리턴 void

resetBodyStream() 공개 메소드

Reset the body stream
public resetBodyStream ( ) : void
리턴 void

setBodyStream() 공개 메소드

Resetss the stream resource pointing to body content.
public setBodyStream ( resource $bodyStream ) : void
$bodyStream resource The body content stream resource
리턴 void

setException() 공개 메소드

Binds the exception to the response.
public setException ( Exception $exception ) : void
$exception Exception The exception to bind.
리턴 void

setHeaders() 공개 메소드

Resets all headers by given array
public setHeaders ( array $headers ) : void
$headers array The headers array
리턴 void

setState() 공개 메소드

Sets state of response
public setState ( integer $state ) : void
$state integer The state value
리턴 void

setStatusCode() 공개 메소드

Sets the http response status code
public setStatusCode ( integer $code ) : void
$code integer The status code to set
리턴 void

setStatusReasonPhrase() 공개 메소드

Sets the status reason phrase
public setStatusReasonPhrase ( string $statusReasonPhrase ) : void
$statusReasonPhrase string The reason phrase
리턴 void