Smutty


Smutty.Smutty_Router

Class Smutty_Router

Smutty_Object
|
+--Smutty_Router

public class Smutty_Router
extends Smutty_Object

this class handles dispatching of requests via the correct controller and action.

/


Constructor Summary

Smutty_Router()

contructor.

Method Summary
nothing

dispatch()

dispatches the request.

String

getActionName()

returns the current action

String

getControllerName()

returns the name of the current controller

String

getDefaultActionName()

returns the name of the default action

String

getDefaultControllerName()

returns the name of the default controller

static Smutty_Router

getInstance()

returns the singleton instance of this class

static String

getRouteSpec(String ctl, String act)

this function searches the application config trying to match a route.

static boolean

isValidControllerName(String name)

tests if a given controller name is valid

private nothing

processRoute(String spec, array url)

this function process the route definition and sets the values accordingly.

nothing

setActionName(String name)

sets the current action name

Constructor Detail

Smutty_Router

public Smutty_Router()

contructor.


Method Detail

dispatch

public nothing dispatch()

dispatches the request.

Go to code

getActionName

public String getActionName()

returns the current action

Returns:
current action name
Go to code

getControllerName

public String getControllerName()

returns the name of the current controller

Returns:
current controller name
Go to code

getDefaultActionName

public String getDefaultActionName()

returns the name of the default action

Returns:
default action
Go to code

getDefaultControllerName

public String getDefaultControllerName()

returns the name of the default controller

Returns:
default controller
Go to code

getInstance

public static Smutty_Router getInstance()

returns the singleton instance of this class

Returns:
the singleton
Go to code

getRouteSpec

public static String getRouteSpec(String ctl, String act)

this function searches the application config trying to match a route. if none is found then the default route will be returned. you can specify a controller and action to find routes bound to them.

Parameters:
ctl - optional controller name
act - optional action name
Returns:
the route url
Go to code

isValidControllerName

public static boolean isValidControllerName(String name)

tests if a given controller name is valid

Parameters:
name - the name to test
Returns:
indicating validity
Go to code

processRoute

private nothing processRoute(String spec, array url)

this function process the route definition and sets the values accordingly. the name "action" is special and changes the current value.

Parameters:
spec - spec string
url - array of url parts
Go to code

setActionName

public nothing setActionName(String name)

sets the current action name

Parameters:
name - the action name
Go to code

Smutty