Response
Response
Assembles the http response and gives you diffrent tools to modify it according to your wishes.
n2n creates an object of this class in its initialization phase lets you access it over the HttpContext.
Constant summary
- STATUS_100_CONTINUE
- STATUS_101_SWITCHING_PROTOCOLS
- STATUS_102_PROCESSING
- STATUS_200_OK
- STATUS_201_CREATED
- STATUS_202_ACCEPTED
- STATUS_203_NON_AUTHORITATIVE_INFORMATION
- STATUS_204_NO_CONTENT
- STATUS_205_RESET_CONTENT
- STATUS_206_PARTIAL_CONTENT
- STATUS_207_MULTI_STATUS
- STATUS_208_ALREADY_REPORTED
- STATUS_226_IM_USED
- STATUS_300_MULTIPLE_CHOICES
- STATUS_301_MOVED_PERMANENTLY
- STATUS_302_FOUND
- STATUS_303_SEE_OTHER
- STATUS_304_NOT_MODIFIED
- STATUS_305_USE_PROXY
- STATUS_307_TEMPORARY_REDIRECT
- STATUS_308_PERMANENT_REDIRECT
- STATUS_400_BAD_REQUEST
- STATUS_401_UNAUTHORIZED
- STATUS_402_PAYMENT_REQUIRED
- STATUS_403_FORBIDDEN
- STATUS_404_NOT_FOUND
- STATUS_405_METHOD_NOT_ALLOWED
- STATUS_406_NOT_ACCEPTABLE
- STATUS_407_PROXY_AUTHENTICATION_REQUIRED
- STATUS_408_REQUEST_TIMEOUT
- STATUS_409_CONFLICT
- STATUS_410_GONE
- STATUS_411_LENGTH_REQUIRED
- STATUS_412_PRECONDITION_FAILED
- STATUS_413_REQUEST_ENTITY_TOO_LARGE
- STATUS_414_REQUEST_URI_TOO_LONG
- STATUS_415_UNSUPPORTED_MEDIA_TYPE
- STATUS_416_REQUEST_RANGE_NOT_SATISFIABLE
- STATUS_417_EXPECTATION_FAILED
- STATUS_418_IM_A_TEAPOT
- STATUS_420_POLICY_NOT_FULFILLED
- STATUS_421_MISDIRECTED_REQUEST
- STATUS_422_UNPROCESSABLE_ENTITY
- STATUS_423_LOCKED
- STATUS_424_FAILED_DEPENDENCY
- STATUS_425_UNORDERED_COLLECTION
- STATUS_426_UPGRADE_REQUIRED
- STATUS_428_PRECONDITION_REQUIRED
- STATUS_429_TOO_MANY_REQUESTS
- STATUS_431_REQUEST_HEADER_FIELDS_TOO_LARGE
- STATUS_451_UNAVAILABLE_FOR_LEGAL_REASONS
- STATUS_500_INTERNAL_SERVER_ERROR
- STATUS_501_NOT_IMPLEMENTED
- STATUS_502_BAD_GATEWAY
- STATUS_503_SERVICE_UNAVAILABLE
- STATUS_504_GATEWAY_TIME_OUT
- STATUS_505_HTTP_VERSION_NOT_SUPPORTED
- STATUS_506_VARIANT_ALSO_NEGOTIATES
- STATUS_507_INSUFFICIENT_STORAGE
- STATUS_508_LOOP_DETECTED
- STATUS_509_BANDWIDTH_LIMIT_EXCEEDED
- STATUS_510_NOT_EXTENDED
- STATUS_511_NETWORK_AUTHENTICATION_REQUIRED
Methods summary
Modifier and Type | Method |
---|---|
public | __construct ( Request request ) |
public Request | getRequest ( ) |
public | setSendEtagAllowed ( bool sendEtagAllowed ) |
public bool | isSendEtagAllowed ( ) |
public | setSendLastModifiedAllowed ( bool sendLastModifiedAllowed ) |
public bool | isSendLastModifiedAllowed ( ) |
public | setServerPushAllowed ( bool serverPushAllowed ) |
public bool | isServerPushAllowed ( ) |
public bool | isResponseCachingEnabled ( ) |
public | setResponseCachingEnabled ( bool responseCachingEnabled ) |
public bool | isHttpCachingEnabled ( ) |
public | setHttpCachingEnabled ( bool httpCachingEnabled ) |
public bool | isBuffering ( ) |
public OutputBuffer | createOutputBuffer ( ) |
public string | getBufferedOutput ( ) |
public string | fetchBufferedOutput ( bool closeBaseBuffer = false ) |
public | reset ( ) |
public boolean | sendCachedPayload ( ) |
public array|null | buildQueryParamsCharacteristic ( ) |
public | flush ( ) |
public | closeBuffer ( ) |
public | setStatus ( int code ) |
public | getStatus ( ) |
public | setHeader ( string header , string replace = true ) |
public | setHttpCacheControl ( HttpCacheControl httpCacheControl = null ) |
public | setResponseCacheControl ( ResponseCacheControl responseCacheControl = null ) |
public | serverPush ( ServerPushDirective directive ) |
public | getResponseCacheStore ( ) |
public | setResponseCacheStore ( ResponseCacheStore responseCacheStore = null ) |
public | send ( Payload thing , bool includeBuffer = true ) |
public | hasSentPayload ( ) |
public | getSentPayload ( ) |
public | registerListener ( ResponseListener listener ) |
public | unregisterListener ( ResponseListener listener ) |
public static int | textOfStatusCode ( int code , bool required = false ) |
Constants in detail
-
STATUS_100_CONTINUE
const STATUS_100_CONTINUE
-
STATUS_101_SWITCHING_PROTOCOLS
const STATUS_101_SWITCHING_PROTOCOLS
-
STATUS_102_PROCESSING
const STATUS_102_PROCESSING
-
STATUS_200_OK
const STATUS_200_OK
-
STATUS_201_CREATED
const STATUS_201_CREATED
-
STATUS_202_ACCEPTED
const STATUS_202_ACCEPTED
-
STATUS_203_NON_AUTHORITATIVE_INFORMATION
const STATUS_203_NON_AUTHORITATIVE_INFORMATION
-
STATUS_204_NO_CONTENT
const STATUS_204_NO_CONTENT
-
STATUS_205_RESET_CONTENT
const STATUS_205_RESET_CONTENT
-
STATUS_206_PARTIAL_CONTENT
const STATUS_206_PARTIAL_CONTENT
-
STATUS_207_MULTI_STATUS
const STATUS_207_MULTI_STATUS
-
STATUS_208_ALREADY_REPORTED
const STATUS_208_ALREADY_REPORTED
-
STATUS_226_IM_USED
const STATUS_226_IM_USED
-
STATUS_300_MULTIPLE_CHOICES
const STATUS_300_MULTIPLE_CHOICES
-
STATUS_301_MOVED_PERMANENTLY
const STATUS_301_MOVED_PERMANENTLY
-
STATUS_302_FOUND
const STATUS_302_FOUND
-
STATUS_303_SEE_OTHER
const STATUS_303_SEE_OTHER
-
STATUS_304_NOT_MODIFIED
const STATUS_304_NOT_MODIFIED
-
STATUS_305_USE_PROXY
const STATUS_305_USE_PROXY
-
STATUS_307_TEMPORARY_REDIRECT
const STATUS_307_TEMPORARY_REDIRECT
-
STATUS_308_PERMANENT_REDIRECT
const STATUS_308_PERMANENT_REDIRECT
-
STATUS_400_BAD_REQUEST
const STATUS_400_BAD_REQUEST
-
STATUS_401_UNAUTHORIZED
const STATUS_401_UNAUTHORIZED
-
STATUS_402_PAYMENT_REQUIRED
const STATUS_402_PAYMENT_REQUIRED
-
STATUS_403_FORBIDDEN
const STATUS_403_FORBIDDEN
-
STATUS_404_NOT_FOUND
const STATUS_404_NOT_FOUND
-
STATUS_405_METHOD_NOT_ALLOWED
const STATUS_405_METHOD_NOT_ALLOWED
-
STATUS_406_NOT_ACCEPTABLE
const STATUS_406_NOT_ACCEPTABLE
-
STATUS_407_PROXY_AUTHENTICATION_REQUIRED
const STATUS_407_PROXY_AUTHENTICATION_REQUIRED
-
STATUS_408_REQUEST_TIMEOUT
const STATUS_408_REQUEST_TIMEOUT
-
STATUS_409_CONFLICT
const STATUS_409_CONFLICT
-
STATUS_410_GONE
const STATUS_410_GONE
-
STATUS_411_LENGTH_REQUIRED
const STATUS_411_LENGTH_REQUIRED
-
STATUS_412_PRECONDITION_FAILED
const STATUS_412_PRECONDITION_FAILED
-
STATUS_413_REQUEST_ENTITY_TOO_LARGE
const STATUS_413_REQUEST_ENTITY_TOO_LARGE
-
STATUS_414_REQUEST_URI_TOO_LONG
const STATUS_414_REQUEST_URI_TOO_LONG
-
STATUS_415_UNSUPPORTED_MEDIA_TYPE
const STATUS_415_UNSUPPORTED_MEDIA_TYPE
-
STATUS_416_REQUEST_RANGE_NOT_SATISFIABLE
const STATUS_416_REQUEST_RANGE_NOT_SATISFIABLE
-
STATUS_417_EXPECTATION_FAILED
const STATUS_417_EXPECTATION_FAILED
-
STATUS_418_IM_A_TEAPOT
const STATUS_418_IM_A_TEAPOT
-
STATUS_420_POLICY_NOT_FULFILLED
const STATUS_420_POLICY_NOT_FULFILLED
-
STATUS_421_MISDIRECTED_REQUEST
const STATUS_421_MISDIRECTED_REQUEST
-
STATUS_422_UNPROCESSABLE_ENTITY
const STATUS_422_UNPROCESSABLE_ENTITY
-
STATUS_423_LOCKED
const STATUS_423_LOCKED
-
STATUS_424_FAILED_DEPENDENCY
const STATUS_424_FAILED_DEPENDENCY
-
STATUS_425_UNORDERED_COLLECTION
const STATUS_425_UNORDERED_COLLECTION
-
STATUS_426_UPGRADE_REQUIRED
const STATUS_426_UPGRADE_REQUIRED
-
STATUS_428_PRECONDITION_REQUIRED
const STATUS_428_PRECONDITION_REQUIRED
-
STATUS_429_TOO_MANY_REQUESTS
const STATUS_429_TOO_MANY_REQUESTS
-
STATUS_431_REQUEST_HEADER_FIELDS_TOO_LARGE
const STATUS_431_REQUEST_HEADER_FIELDS_TOO_LARGE
-
STATUS_451_UNAVAILABLE_FOR_LEGAL_REASONS
const STATUS_451_UNAVAILABLE_FOR_LEGAL_REASONS
-
STATUS_500_INTERNAL_SERVER_ERROR
const STATUS_500_INTERNAL_SERVER_ERROR
-
STATUS_501_NOT_IMPLEMENTED
const STATUS_501_NOT_IMPLEMENTED
-
STATUS_502_BAD_GATEWAY
const STATUS_502_BAD_GATEWAY
-
STATUS_503_SERVICE_UNAVAILABLE
const STATUS_503_SERVICE_UNAVAILABLE
-
STATUS_504_GATEWAY_TIME_OUT
const STATUS_504_GATEWAY_TIME_OUT
-
STATUS_505_HTTP_VERSION_NOT_SUPPORTED
const STATUS_505_HTTP_VERSION_NOT_SUPPORTED
-
STATUS_506_VARIANT_ALSO_NEGOTIATES
const STATUS_506_VARIANT_ALSO_NEGOTIATES
-
STATUS_507_INSUFFICIENT_STORAGE
const STATUS_507_INSUFFICIENT_STORAGE
-
STATUS_508_LOOP_DETECTED
const STATUS_508_LOOP_DETECTED
-
STATUS_509_BANDWIDTH_LIMIT_EXCEEDED
const STATUS_509_BANDWIDTH_LIMIT_EXCEEDED
-
STATUS_510_NOT_EXTENDED
const STATUS_510_NOT_EXTENDED
-
STATUS_511_NETWORK_AUTHENTICATION_REQUIRED
const STATUS_511_NETWORK_AUTHENTICATION_REQUIRED
Methods in detail
-
__construct
param
-
getRequest
Request public getRequest ( )return
-
setSendEtagAllowed
public setSendEtagAllowed ( bool sendEtagAllowed )If true the response will use etags to determine if the response was modified since last request and send 304 Not Modified http status to reduce traffic if not.param
bool sendEtagAllowed -
isSendEtagAllowed
bool public isSendEtagAllowed ( ) -
setSendLastModifiedAllowed
public setSendLastModifiedAllowed ( bool sendLastModifiedAllowed )If last modified DateTime is provided by the sent Payload it will be used to determine if the response was modified since last request and send 304 Not Modified http status to reduce traffic if not. -
isSendLastModifiedAllowed
bool public isSendLastModifiedAllowed ( ) -
setServerPushAllowed
public setServerPushAllowed ( bool serverPushAllowed )If false all server push directives mandated be Response::serverPush() will be ignored. This option is usually modified through changes in the app.ini.param
bool sendLastModifiedAllowed -
isServerPushAllowed
bool public isServerPushAllowed ( ) -
isResponseCachingEnabled
bool public isResponseCachingEnabled ( ) -
setResponseCachingEnabled
public setResponseCachingEnabled ( bool responseCachingEnabled )If false response cache configurations assigned over Response::setHttpCacheControl() will be ignored.param
bool httpCachingEnabled -
isHttpCachingEnabled
bool public isHttpCachingEnabled ( ) -
setHttpCachingEnabled
public setHttpCachingEnabled ( bool httpCachingEnabled )If false http cache configurations assigned over Response::setHttpCacheControl() will be ignored.param
bool httpCachingEnabled -
isBuffering
bool public isBuffering ( )return
bool -
createOutputBuffer
OutputBuffer public createOutputBuffer ( )return
-
getBufferedOutput
string public getBufferedOutput ( )return
string -
fetchBufferedOutput
string public fetchBufferedOutput ( bool closeBaseBuffer = false )param
bool closeBaseBufferreturn
string -
reset
public reset ( ) -
sendCachedPayload
boolean public sendCachedPayload ( )return
boolean -
buildQueryParamsCharacteristic
array|null public buildQueryParamsCharacteristic ( )return
n2n\web\http\array|null -
flush
public flush ( ) -
closeBuffer
public closeBuffer ( ) -
setStatus
public setStatus ( int code )param
int code -
getStatus
public getStatus ( ) -
setHeader
public setHeader ( string header , string replace = true )param
string headerstring replace -
setHttpCacheControl
-
setResponseCacheControl
-
serverPush
Server push will be ignored if HTTP version of request is lower than 2 or if sever push is disabled in app.iniparam
-
getResponseCacheStore
public getResponseCacheStore ( ) -
setResponseCacheStore
-
send
-
hasSentPayload
public hasSentPayload ( ) -
getSentPayload
public getSentPayload ( ) -
registerListener
-
unregisterListener
-
textOfStatusCode
int public static textOfStatusCode ( int code , bool required = false )