JApplicationWebRouterRest

Extends \JApplicationWebRouterBase

RESTful Web application router class for the Joomla Platform.

deprecated
since

3.0

deprecated

4.0 Use the joomla/router package via Composer instead

package

Joomla.Platform

Methods

__construct

Constructor.

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

3.0

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

3.0

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

3.0

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

3.0

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

3.0

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

3.0

throws

\RuntimeException

Response

string

isMethodInPostRequest

Get the property to allow or not method in POST request

isMethodInPostRequest() : boolean
since

3.0

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

3.0

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

3.0

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

3.0

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

3.0

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

3.0

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

since

3.0

Type(s)

boolean

suffixMap

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

since

3.0

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
since

3.0

Type(s)

array

app

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

inherited
since

3.0

Type(s)

\JApplicationWeb

default

The default page controller name for an empty route.

inherited
since

3.0

Type(s)

string

controllerPrefix

Controller class name prefix for creating controller objects by name.

inherited
since

3.0

Type(s)

string

input

An input object from which to derive the route.

inherited
since

3.0

Type(s)

\JInput