API CHANGE #2857 - Renamed RequestHandlingData to RequestHandler

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64953 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-10-30 22:03:21 +00:00
parent 185f81492e
commit cd699e3d89
12 changed files with 26 additions and 26 deletions

View File

@ -9,7 +9,7 @@
* @package sapphire
* @subpackage control
*/
class Controller extends RequestHandlingData {
class Controller extends RequestHandler {
/**
* @var array $urlParams An array of arguments extracted from the URL

View File

@ -77,8 +77,8 @@ class Director {
* request.
* - Controller::handleRequest($request) is then called. This will find a rule to handle the URL, and call the rule
* handling method.
* - RequestHandlingData::handleRequest($request) is recursively called whenever a rule handling method returns a
* RequestHandlingData object.
* - RequestHandler::handleRequest($request) is recursively called whenever a rule handling method returns a
* RequestHandler object.
*
* In addition to request processing, Director will manage the session, and perform the output of the actual response
* to the browser.

View File

@ -2,11 +2,11 @@
/**
* Represents a HTTP-request, including a URL that is tokenised for parsing, and a request method (GET/POST/PUT/DELETE).
* This is used by {@link RequestHandlingData} objects to decide what to do.
* This is used by {@link RequestHandler} objects to decide what to do.
*
* The intention is that a single HTTPRequest object can be passed from one object to another, each object calling
* match() to get the information that they need out of the URL. This is generally handled by
* {@link RequestHandlingData::handleRequest()}.
* {@link RequestHandler::handleRequest()}.
*
* @todo Accept X_HTTP_METHOD_OVERRIDE http header and $_REQUEST['_method'] to override request types (useful for webclients
* not supporting PUT and DELETE)
@ -66,7 +66,7 @@ class HTTPRequest extends Object implements ArrayAccess {
/**
* @var array $allParams Contains an assiciative array of all
* arguments matched in all calls to {@link RequestHandlingData->handleRequest()}.
* arguments matched in all calls to {@link RequestHandler->handleRequest()}.
* Its a "historical record" thats specific to the current call of
* {@link handleRequest()}, and is only complete once the "last call" to that method is made.
*/
@ -74,10 +74,10 @@ class HTTPRequest extends Object implements ArrayAccess {
/**
* @var array $latestParams Contains an associative array of all
* arguments matched in the current call from {@link RequestHandlingData->handleRequest()},
* arguments matched in the current call from {@link RequestHandler->handleRequest()},
* as denoted with a "$"-prefix in the $url_handlers definitions.
* Contains different states throughout its lifespan, so just useful
* while processed in {@link RequestHandlingData} and to get the last
* while processed in {@link RequestHandler} and to get the last
* processes arguments.
*/
protected $latestParams = array();
@ -330,7 +330,7 @@ class HTTPRequest extends Object implements ArrayAccess {
if($varRequired && !isset($this->dirParts[$i])) return false;
$arguments[$varName] = isset($this->dirParts[$i]) ? $this->dirParts[$i] : null;
if($part == '$Controller' && (!class_exists($arguments['Controller']) || !is_subclass_of($arguments['Controller'], 'RequestHandlingData'))) {
if($part == '$Controller' && (!class_exists($arguments['Controller']) || !is_subclass_of($arguments['Controller'], 'RequestHandler'))) {
return false;
}
@ -393,7 +393,7 @@ class HTTPRequest extends Object implements ArrayAccess {
/**
* Returns the unparsed part of the original URL
* separated by commas. This is used by {@link RequestHandlingData->handleRequest()}
* separated by commas. This is used by {@link RequestHandler->handleRequest()}
* to determine if further URL processing is necessary.
*
* @return string Partial URL

View File

@ -3,7 +3,7 @@
/**
* This class is the base class of any Sapphire object that can be used to handle HTTP requests.
*
* Any RequestHandlingData object can be made responsible for handling its own segment of the URL namespace.
* Any RequestHandler object can be made responsible for handling its own segment of the URL namespace.
* The {@link Director} begins the URL parsing process; it will parse the beginning of the URL to identify which
* controller is being used. It will then call {@link handleRequest()} on that Controller, passing it the parameters that it
* parsed from the URL, and the {@link HTTPRequest} that contains the remainder of the URL to be parsed.
@ -17,15 +17,15 @@
* - Director will determine that admin/crm is controlled by a new ModelAdmin object, and pass control to that.
* Matching Director Rule: "admin/crm" => "ModelAdmin" (defined in mysite/_config.php)
* - ModelAdmin will determine that SearchForm is controlled by a Form object returned by $this->SearchForm(), and pass control to that.
* Matching $url_handlers: "$Action" => "$Action" (defined in RequestHandlingData class)
* Matching $url_handlers: "$Action" => "$Action" (defined in RequestHandler class)
* - Form will determine that field/Groups is controlled by the Groups field, a TreeMultiselectField, and pass control to that.
* Matching $url_handlers: 'field/$FieldName!' => 'handleField' (defined in Form class)
* - TreeMultiselectField will determine that treesegment/36 is handled by its treesegment() method. This method will return an HTML fragment that is output to the screen.
* Matching $url_handlers: "$Action/$ID" => "handleItem" (defined in TreeMultiSelectField class)
*
* {@link RequestHandlingData::handleRequest()} is where this behaviour is implemented.
* {@link RequestHandler::handleRequest()} is where this behaviour is implemented.
*/
class RequestHandlingData extends ViewableData {
class RequestHandler extends ViewableData {
protected $request = null;
/**
@ -72,7 +72,7 @@ class RequestHandlingData extends ViewableData {
* @param $request The {@link HTTPRequest} object that is reponsible for distributing URL parsing
* @uses HTTPRequest
* @uses HTTPRequest->match()
* @return HTTPResponse|RequestHandlingData|string|array
* @return HTTPResponse|RequestHandler|string|array
*/
function handleRequest($request) {
$this->request = $request;
@ -107,10 +107,10 @@ class RequestHandlingData extends ViewableData {
return $result;
}
// If we return a RequestHandlingData, call handleRequest() on that, even if there is no more URL to parse.
// If we return a RequestHandler, call handleRequest() on that, even if there is no more URL to parse.
// It might have its own handler. However, we only do this if we haven't just parsed an empty rule ourselves,
// to prevent infinite loops
if(!$request->isEmptyPattern($rule) && is_object($result) && $result instanceof RequestHandlingData) {
if(!$request->isEmptyPattern($rule) && is_object($result) && $result instanceof RequestHandler) {
$returnValue = $result->handleRequest($request);
// Array results can be used to handle
@ -143,7 +143,7 @@ class RequestHandlingData extends ViewableData {
// Collate self::$allowed_actions from this class and all parent classes
$access = null;
$className = $this->class;
while($className != 'RequestHandlingData') {
while($className != 'RequestHandler') {
// Merge any non-null parts onto $access.
$accessPart = eval("return $className::\$allowed_actions;");
if($accessPart !== null) $access = array_merge((array)$access, $accessPart);

View File

@ -866,7 +866,7 @@ class SiteTree extends DataObject {
$count = 1;
while (
(class_exists($this->URLSegment) && is_subclass_of($this->URLSegment, 'RequestHandlingData')) ||
(class_exists($this->URLSegment) && is_subclass_of($this->URLSegment, 'RequestHandler')) ||
DataObject::get_one("SiteTree", "URLSegment = '$this->URLSegment' $idFilter")
) {
$count++;

View File

@ -11,7 +11,7 @@
* cd /my/project/
* sake dev/modules/add ecommerce
*/
class ModuleManager extends RequestHandlingData {
class ModuleManager extends RequestHandler {
protected $moduleBase = "http://svn.silverstripe.com/open/modules/";
static $allowed_actions = array(

View File

@ -587,7 +587,7 @@ JS;
/**
* @todo Tie this into ComplexTableField_Item better.
*/
class ComplexTableField_ItemRequest extends RequestHandlingData {
class ComplexTableField_ItemRequest extends RequestHandler {
protected $ctf;
protected $itemID;
protected $methodName;

View File

@ -21,7 +21,7 @@
* @package forms
* @subpackage core
*/
class Form extends RequestHandlingData {
class Form extends RequestHandler {
/**
* @var boolean $includeFormTag Accessed by Form.ss; modified by {@link formHtmlContent()}.

View File

@ -7,7 +7,7 @@
* @package forms
* @subpackage core
*/
class FormField extends RequestHandlingData {
class FormField extends RequestHandler {
protected $form;
protected $name, $title, $value ,$message, $messageType, $extraClass;

View File

@ -256,7 +256,7 @@ function HtmlEditorField_dataValue_processImage($parts) {
* @package forms
* @subpackage fields-formattedinput
*/
class HtmlEditorField_Toolbar extends RequestHandlingData {
class HtmlEditorField_Toolbar extends RequestHandler {
protected $controller, $name;
function __construct($controller, $name) {

View File

@ -1333,7 +1333,7 @@ class TableListField_Item extends ViewableData {
}
}
class TableListField_ItemRequest extends RequestHandlingData {
class TableListField_ItemRequest extends RequestHandler {
protected $ctf;
protected $itemID;
protected $methodName;

View File

@ -1,7 +1,7 @@
<?php
/**
* Tests for RequestHandlingData and HTTPRequest.
* Tests for RequestHandler and HTTPRequest.
* We've set up a simple URL handling model based on
*/
class RequestHandlingTest extends SapphireTest {