JApplicationWebRouterRest

Extends \JApplicationWebRouterBase

RESTful Web application router class for the Joomla Platform.

deprecated
since

12.2

deprecated

3.7.0 Use the joomla/router package via Composer instead

package

Joomla.Platform

Methods

__construct

Constructor.

__construct(\JApplicationWeb $app, \JInput $input = null) 
inherited
since

12.2

Arguments

$app

\JApplicationWebThe web application on whose behalf we are routing the request.

$input

\JInputAn optional input object from which to derive the route. If none is given than the input from the application object will be used.

addMap

Add a route map to the router. If the pattern already exists it will be overwritten.

addMap(string $pattern, string $controller) : \JApplicationWebRouter
inherited
since

12.2

Arguments

$pattern

stringThe route pattern to use for matching.

$controller

stringThe controller name to map to the given pattern.

Response

\JApplicationWebRouterThis object for method chaining.

addMaps

Add a route map to the router. If the pattern already exists it will be overwritten.

addMaps(array $maps) : \JApplicationWebRouter
inherited
since

12.2

Arguments

$maps

arrayA list of route maps to add to the router as $pattern => $controller.

Response

\JApplicationWebRouterThis object for method chaining.

execute

Find and execute the appropriate controller based on a given route.

execute(string $route) : mixed
inherited
since

12.2

throws

\InvalidArgumentException

\RuntimeException

Arguments

$route

stringThe route string for which to find and execute a controller.

Response

mixedThe return value of the controller executed

fetchController

Get a JController object for a given name.

fetchController(string $name) : \JController
inherited
since

12.2

throws

\RuntimeException

Arguments

$name

stringThe controller name (excluding prefix) for which to fetch and instance.

Response

\JController

fetchControllerSuffix

Get the controller class suffix string.

fetchControllerSuffix() : string
since

12.2

throws

\RuntimeException

Response

string

isMethodInPostRequest

Get the property to allow or not method in POST request

isMethodInPostRequest() : boolean
since

12.2

Response

boolean

parseRoute

Parse the given route and return the name of a controller mapped to the given route.

parseRoute(string $route) : string
inherited abstract
since

12.2

throws

\InvalidArgumentException

Arguments

$route

stringThe route string for which to find and execute a controller.

Response

stringThe controller name for the given route excluding prefix.

setControllerPrefix

Set the controller name prefix.

setControllerPrefix(string $prefix) : \JApplicationWebRouter
inherited
since

12.2

Arguments

$prefix

stringController class name prefix for creating controller objects by name.

Response

\JApplicationWebRouterThis object for method chaining.

setDefaultController

Set the default controller name.

setDefaultController(string $name) : \JApplicationWebRouter
inherited
since

12.2

Arguments

$name

stringThe default page controller name for an empty route.

Response

\JApplicationWebRouterThis object for method chaining.

setHttpMethodSuffix

Set a controller class suffix for a given HTTP method.

setHttpMethodSuffix(string $method, string $suffix) : \JApplicationWebRouter
since

12.2

Arguments

$method

stringThe HTTP method for which to set the class suffix.

$suffix

stringThe class suffix to use when fetching the controller name for a given request.

Response

\JApplicationWebRouterThis object for method chaining.

setMethodInPostRequest

Set to allow or not method in POST request

setMethodInPostRequest(boolean $value) : void
since

12.2

Arguments

$value

booleanA boolean to allow or not method in POST request

Properties

methodInPostRequest

A boolean allowing to pass _method as parameter in POST requests

Type(s)

boolean

suffixMap

An array of HTTP Method => controller suffix pairs for routing the request.

Type(s)

array

maps

An array of rules, each rule being an associative array('regex'=> $regex, 'vars' => $vars, 'controller' => $controller) for routing the request.

inherited

Type(s)

array

app

The web application on whose behalf we are routing the request.

inherited

Type(s)

\JApplicationWeb

default

The default page controller name for an empty route.

inherited

Type(s)

string

controllerPrefix

Controller class name prefix for creating controller objects by name.

inherited

Type(s)

string

input

An input object from which to derive the route.

inherited

Type(s)

\JInput