namespace \webfiori\http
class Response
Class Methods Summary
public static function addHeader(string$headerName, string$headerVal, boolean$isReplace)Adds new HTTP header to the response.public static function beforeSend(Closure$func)Adds a function to execute before sending the final response.public static function clear()Removes all added headers and reset the body of the response.public static function clearBody()Reset the body of the response.public static function clearHeaders()Removes all headers which where added to the response.public static function getBody()Returns a string that represents response body that will be send.public static function getCode()Returns the value of HTTP response code that will be sent.public static function getHeader(array$headerName)Returns the value(s) of specific HTTP header.public static function getHeaders()Returns an associative array that contains response headers.public static function hasHeader(string$headerName, string$headerVal)Checks if the response will have specific header or not.public static function isSent()Checks if the response was sent or not.public static function removeHeader(string$headerName, string|null$headerVal)Removes a header from the response.public static function send()Send the response.public static function setCode(int$code)Sets the value of HTTP response code that will be sent.public static function write(string$str)Appends a string to response body.Class Methods Details
public static function beforeSend(Closure$func)Adds a function to execute before sending the final response. This method can be used to add more than one callback.Parameters:
- Closure $func A PHP callable.
public static function clear()Removes all added headers and reset the body of the response. Returns: Responsepublic static function clearBody()Reset the body of the response. Returns: Responsepublic static function getBody()Returns a string that represents response body that will be send. Returns: stringA string that represents response body that will be send.public static function getCode()Returns the value of HTTP response code that will be sent. Returns: intHTTP response code. Default value is 200.public static function isSent()Checks if the response was sent or not. Returns: booleanThe method will return true if output is sent. False if not.public static function send()Send the response. Note that if this method is called outside CLI environment, it will terminate the execution of code once the output is sent. In terminal environment, calling it will have no effect.public static function setCode(int$code)Sets the value of HTTP response code that will be sent. Parameters:
- int $code HTTP response code. The value must be between 100 and 599 inclusive.
public static function write(string$str)Appends a string to response body. Parameters:
- string $str The string that will be appended.
Returns: Response mdi-menuAll Classesmdi-chevron-left\webfiori\uiAnchorBrCodeSnippetHTMLDocHTMLListHTMLNodeHTMLTableHeadNodeInputJsCodeLabelListItemOrderedListParagraphRadioGroupTableCellTableRowUnorderedList\webfiori\ui\exceptionsInvalidNodeNameExceptionTemplateNotFoundException\webfiori\jsonCaseConverterJsonJsonConverterJsonIJsonTypesProperty\webfiori\httpAPIFilterAbstractWebServiceManagerInfoServiceParamTypesRequestRequestParameterResponseUriWebServicesManager\webfiori\frameworkAccessAutoLoaderConfigConfigControllerDBEAbstractWebServiceExtendedWebServicesManagerFileLoggerPrivilegePrivilegesGroupThemeThemeLoaderUploadFileUploaderUserUtilWebFioriApp\webfiori\framework\i18nLanguage\webfiori\framework\uiErrorBoxHTTPCodeViewMessageBoxServerErrViewStarterPageWebPage\webfiori\framework\sessionDatabaseSessionStorageDefaultSessionStorageMSSQLSessionDataTableMSSQLSessionsTableMySQLSessionDataTableMySQLSessionsTableSessionSessionOperationsSessionStorageSessionsManager\webfiori\framework\routerRouterRouterUri\webfiori\framework\middlewareAbstractMiddlewareMiddlewareManager\webfiori\framework\mailEmailMessageSMTPAccountSMTPServer\webfiori\framework\exceptionsClassLoaderExceptionFileExceptionInitializationExceptionInvalidCRONExprExceptionMissingLangExceptionNoSuchThemeExceptionRoutingExceptionSMTPExceptionSessionExceptionUIException\webfiori\framework\cronAbstractJobCronCronEmailCronJobJobArgument\webfiori\framework\cron\webUICronLoginViewCronTasksViewCronView\webfiori\framework\cron\webServicesCronLoginServiceCronLogoutServiceCronServicesManagerForceCronExecutionServiceGetJobsService\webfiori\framework\cliCLICLICommandInputStreamOutputStreamStdInStdOut\webfiori\framework\cli\writersClassWriterLangClassWriterQueryClassWriterServiceHolderThemeClassWriterWebServiceWriter\webfiori\framework\cli\helpersCreateCLIClassHelperCreateCronJobCreateMiddlewareCreateTableCreateTableObjCreateThemeHelperCreateWebService\webfiori\framework\cli\commandsAddCommandCreateCommandCronCommandHelpCommandListCronCommandListRoutesCommandListThemesCommandRunSQLQueryCommandSettingsCommandTestRouteCommandUpdateSettingsCommandUpdateTableCommandVersionCommand\webfiori\databaseAbstractQueryColumnColumnFactoryConditionConnectionConnectionInfoDatabaseDatabaseExceptionDateTimeValidatorEntityMapperExpressionForeignKeyJoinTableResultSetSelectExpressionTableWhereExpression\webfiori\database\mysqlMySQLColumnMySQLConnectionMySQLQueryMySQLTable\webfiori\database\mssqlMSSQLColumnMSSQLConnectionMSSQLQueryMSSQLTable\webfiori\collectionsAbstractCollectionComparableLinkedListNodeQueueStackLearnmdi-information-variantAPI Referencemdi-information-variantDownloadmdi-information-variantContributemdi-information-variant