Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update API docs

View switching only happens for known mime types.
Refs #2565
  • Loading branch information...
commit ab09229d405939234c3439ec8151aee145325183 1 parent 4c01ba7
@markstory markstory authored
View
5 lib/Cake/Controller/Component/RequestHandlerComponent.php
@@ -159,7 +159,10 @@ protected function _setExtension() {
* switched based on the parsed extension or Accept-Type header. For example, if `controller/action.xml`
* is requested, the view path becomes `app/View/Controller/xml/action.ctp`. Also if
* `controller/action` is requested with `Accept-Type: application/xml` in the headers
- * the view path will become `app/View/Controller/xml/action.ctp`.
+ * the view path will become `app/View/Controller/xml/action.ctp`. Layout and template
+ * types will only switch to mime-types recognized by CakeResponse. If you need to declare
+ * additional mime-types, you can do so using CakeResponse::type() in your controllers beforeFilter()
+ * method.
* - If a helper with the same name as the extension exists, it is added to the controller.
* - If the extension is of a type that RequestHandler understands, it will set that
* Content-type in the response header.
View
6 lib/Cake/Routing/Router.php
@@ -1030,15 +1030,17 @@ public static function stripPlugin($base, $plugin = null) {
* Instructs the router to parse out file extensions from the URL. For example,
* http://example.com/posts.rss would yield an file extension of "rss".
* The file extension itself is made available in the controller as
- * $this->params['url']['ext'], and is used by the RequestHandler component to
+ * `$this->params['ext']`, and is used by the RequestHandler component to
* automatically switch to alternate layouts and templates, and load helpers
- * corresponding to the given content, i.e. RssHelper.
+ * corresponding to the given content, i.e. RssHelper. Switching layouts and helpers
+ * requires that the chosen extension has a defined mime type in `CakeResponse`
*
* A list of valid extension can be passed to this method, i.e. Router::parseExtensions('rss', 'xml');
* If no parameters are given, anything after the first . (dot) after the last / in the URL will be
* parsed, excluding querystring parameters (i.e. ?q=...).
*
* @return void
+ * @see RequestHandler::startup()
*/
public static function parseExtensions() {
self::$_parseExtensions = true;
Please sign in to comment.
Something went wrong with that request. Please try again.