Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Controller_Router_Route_Rest Component Proposal

Proposed Component Name Zend_Controller_Router_Route_Rest
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Controller_Router_Route_Rest
Proposers luke.crouch@gmail.com
Matthew Weier O'Phinney - Zend Liaison
Revision 1.0 - 23 Feb 2008: Started.
1.0 - 15 May 2008: changed from Route class to full-on Router class.
1.0 - 15 May 2008: changed back to Route class
2.0 - 01 Jan 2009: updated Route class for ZF 1.7 compatibility
2.0 - 30 Jun 2009: development started under ZF-7109 (wiki revision: 46)

Table of Contents

1. Overview

Zend_Rest_Route is a route that uses URI to route the module & controller and HTTP request method to route to the action of a Zend_Controller_Action_Rest controller.

Zend_Rest_Controller is an abstract action controller designating the action methods to implement for use with Zend_Controller_Router_Route_Rest.

Zend_Rest_PutHandler is a controller plugin to improve PUT body handling - enables controllers to access x-www-form-urlencoded PUT bodies via getParams().

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will operate as a Route class of the Rewrite Router.
  • This component will route to Modules and Controllers based on URI tokens.
  • This component will route to specific Actions based on HTTP request types.
  • This component will support overloaded-POST-based routing for PUT and DELETE request types.
  • This component will route to some special Actions based on URI tokens.
  • This component will include an abstract Zend_Controller_Action class for implementation reference.
  • This component will allow for designating specific REST Modules and/or Controllers

4. Dependencies on Other Framework Components

  • Zend_Controller

5. Theory of Operation

A RESTful routing paradigm for Zend_Controller should behave as follows:

Request method URI Module_Controller::action
GET /product/ratings/ Product_RatingsController::indexAction()
GET /product/ratings/id/:id Product_RatingsController::getAction()
GET /product/ratings/new Product_RatingsController::newAction()
GET /product/ratings/id/:id/edit Product_RatingsController::editAction()
POST /product/ratings Product_RatingsController::postAction()
PUT /product/ratings/id/:id Product_RatingsController::putAction()
DELETE /product/ratings/id/:id Product_RatingsController::deleteAction()
POST /product/ratings/id/:id
_method=PUT
Product_RatingsController::putAction()
POST /product/ratings/id/:id
_method=DELETE
Product_RatingsController::deleteAction()

6. Milestones / Tasks

  • Milestone 1: Working prototype checked into the incubator supporting use cases #1
  • Milestone 2: Unit tests exist, work, and are checked into SVN.
  • Milestone 3: Initial documentation exists.

7. Class Index

  • Zend_Rest_Route
  • Zend_Rest_Controller
  • Zend_Rest_PutHandler

8. Use Cases

9. Class Skeletons