The CoreUrl class parses the URL into segments and filters. It's called from the CoreBootstrap class and its most important function is being used by the bootstrap to determine the controller and then by the controller to determine the display method.
The URL class is a singleton meaning there can only be one instance of it at a time.
The URL segments are the parts of the URL after the domain. For example if the URL is http://www.example.org/foo/bar/ then foo and bar are the segments. See the chapter on routing for more information on how these segments are used to determine the controller and how to re-route URLs to other controllers.
The URL filters are a hybrid between query string variables and URL segments. If any part of the URL has an equals sign in it then it will be treated as a filter rather than a segment. For example if the URL is http://www.example.org/foo/bar/page=1/ then page would be considered a filter with a value of 1.
Filters can appear anywhere in a URL and they won't affect the segments which determine the controller. Filters are not considered segments and are not available in the segments array.
It's possible to forward from one controller to another by explicitly setting a new URL and re-running the CoreUrl's init() method followed by redetermining and changing the controller in the bootstrap. This method of forwarding has the benefit of the URL object having the new forwarded URL in it so that a call to something like getCurrentUrl() would return the forwarded URL. The other method of forwarding, which doesn't change the URL, is detailed in the CoreBootstrap chapter.
$objUrl = AppUrl::getInstance();
$objUrl->setBaseUrl(AppConfig::get('BaseUrl'));
$objUrl->setRoutes(AppConfig::get('Routes', false));
AppRegistry::register('Url', $objUrl);
//in this example the url is http://www.example.org/foo/bar/page=1/user=phork/index.xml
$objUrl = AppRegistry::get('Url');
//get the first url segment which is foo
$strSegment = $objUrl->getSegment(0);
//get the second url segment which is bar
$strSegment = $objUrl->getSegment(1);
//get all the url segments which is an array with foo and bar
$arrSegments = $objUrl->getSegments();
//get the page number which will be returned as 1
$intPage = $objUrl->getFilter('page');
//get all the filters which is an associative array
$arrFilters = $objUrl->getFilters();
//get the file extension (eg. css, js, xml, etc)
$strExtension = $objUrl->getExtension();
//this will result in the app thinking it's at http://www.example.org/the/forwarded/url/
$objUrl = AppUrl::getInstance();
$objUrl->setUrl('/the/forwarded/url/');
$objUrl->init();
$objBootstrap = AppRegistry::get('Bootstrap');
$objBootstrap->changeController($objBootstrap->determineController());