WebFioriAPI ReferenceLearnDownloadContributeLearn{{result.parent_page}} > {{result.title}}{{result.title}}Classes{{result.class_name}}{{result.summary}}Methods{{result.name}}{{result.summary}}

namespace \webfiori\framework\middleware

abstract class AbstractMiddleware

Class Methods Summary

public function __construct(string$name)Creates new instance of the class.public function addToGroup(string$groupName)Adds the middleware to specific group.public function addToGroups(array$groupsArr)Adds the middleware to more than one group.public abstract function after()Perform an action after accessing application level and before sending the request.public abstract function afterSend()Perform an action after sending the response and before terminating the application.public abstract function before()Perform an action before accessing application level.public function compare(AbstractMiddleware$other)Compare the priority of the middleware with another one.public function getGroups()Returns an array that holds the names of the groups that the middleware belongs to.public function getName()Returns the name of the middleware.public function getPriority()Returns the priority of the middleware.public function setName(string$name)Sets the name of the middleware.public function setPriority(int$priority)Sets the priority of the middleware.

Class Methods Details

public function __construct(string$name)Creates new instance of the class.

Parameters:

  • string $name A unique name for the middleware. The name will be used later to assign the middleware to specific routes.
public function addToGroup(string$groupName)Adds the middleware to specific group. Group name can be used to apply multiple middlewares to specific route.

Parameters:

  • string $groupName The name of the group.
public function addToGroups(array$groupsArr)Adds the middleware to more than one group.

Parameters:

  • array $groupsArr An array that contains the mames of the groups.
public abstract function after()Perform an action after accessing application level and before sending the request. This method can be used to add extra payload to the response or even change it totally before sending back the response.public abstract function afterSend()Perform an action after sending the response and before terminating the application. public abstract function before()Perform an action before accessing application level. This method will get executed before routing happens. One use case of this method is to use it to check if the user is authorized to access the system or not. If he is not, then send back a redirect header that takes the user to login screen or just send a 401 response code with a message.public function compare(AbstractMiddleware$other)Compare the priority of the middleware with another one. The main aim of this method is to prioritize which middleware will be reached first. First the method checks the priority of the middleware. If the two have same priority, it will use the name of the middleware.

Parameters:

Returns: int
public function getGroups()Returns an array that holds the names of the groups that the middleware belongs to. Returns: arrayAn array that holds the names of the groups that the middleware belongs to.public function getName()Returns the name of the middleware. Returns: stringthe name of the middleware.public function getPriority()Returns the priority of the middleware. Returns: intPriority of the middleware.public function setName(string$name)Sets the name of the middleware. The name of the middleware is used to assign it to a route. For this reason, each middleware must have a unique name.

Parameters:

  • string $name The name of the middleware.
Returns: booleanIf the name is set, the method will return true. If not set, the method will return false.
public function setPriority(int$priority)Sets the priority of the middleware. Priority of middleware is used to specify which middleware will be reached first. The higher the priority, the sooner the middleware will be reached. For example, a middleware with priority 100 will be reached before a middleware with priority 99.

Parameters:

  • int $priority Middleware priority.
mdi-menuAll Classesmdi-chevron-leftAnchorBrCodeSnippetHTMLDocHTMLListHTMLNodeHTMLTableHeadNodeInputJsCodeLabelListItemOrderedListParagraphRadioGroupTableCellTableRowUnorderedListInvalidNodeNameExceptionTemplateNotFoundExceptionCaseConverterJsonJsonConverterJsonIJsonTypesPropertyAPIFilterAbstractWebServiceManagerInfoServiceParamTypesRequestRequestParameterResponseUriWebServicesManagerAccessAutoLoaderConfigConfigControllerDBEAbstractWebServiceExtendedWebServicesManagerFileLoggerPrivilegePrivilegesGroupThemeThemeLoaderUploadFileUploaderUserUtilWebFioriAppLanguageErrorBoxHTTPCodeViewMessageBoxServerErrViewStarterPageWebPageDatabaseSessionStorageDefaultSessionStorageMSSQLSessionDataTableMSSQLSessionsTableMySQLSessionDataTableMySQLSessionsTableSessionSessionOperationsSessionStorageSessionsManagerRouterRouterUriAbstractMiddlewareMiddlewareManagerEmailMessageSMTPAccountSMTPServerClassLoaderExceptionFileExceptionInitializationExceptionInvalidCRONExprExceptionMissingLangExceptionNoSuchThemeExceptionRoutingExceptionSMTPExceptionSessionExceptionUIExceptionAbstractJobCronCronEmailCronJobJobArgumentCronLoginViewCronTasksViewCronViewCronLoginServiceCronLogoutServiceCronServicesManagerForceCronExecutionServiceGetJobsServiceCLICLICommandInputStreamOutputStreamStdInStdOutClassWriterLangClassWriterQueryClassWriterServiceHolderThemeClassWriterWebServiceWriterCreateCLIClassHelperCreateCronJobCreateMiddlewareCreateTableCreateTableObjCreateThemeHelperCreateWebServiceAddCommandCreateCommandCronCommandHelpCommandListCronCommandListRoutesCommandListThemesCommandRunSQLQueryCommandSettingsCommandTestRouteCommandUpdateSettingsCommandUpdateTableCommandVersionCommandAbstractQueryColumnColumnFactoryConditionConnectionConnectionInfoDatabaseDatabaseExceptionDateTimeValidatorEntityMapperExpressionForeignKeyJoinTableResultSetSelectExpressionTableWhereExpressionMySQLColumnMySQLConnectionMySQLQueryMySQLTableMSSQLColumnMSSQLConnectionMSSQLQueryMSSQLTableAbstractCollectionComparableLinkedListNodeQueueStack
Powered By: WebFiori Framework, Vue and VuetifyAll Rights Reserved © 2018 - 2024