Skip to content

Commit 08e4aab

Browse files
Fix text about responders
Signed-off-by: Christian Wolf <[email protected]>
1 parent 4b76fec commit 08e4aab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

developer_manual/basics/controllers.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@ Because returning JSON is such a common task, there's even a shorter way to do t
382382
383383
Why does this work? Because the dispatcher sees that the controller did not return a subclass of a Response and asks the controller to turn the value into a Response. That's where responders come in.
384384

385+
.. _controller-responders:
386+
385387
Responders
386388
^^^^^^^^^^
387389

@@ -762,7 +764,11 @@ To use OCS in your API you can use the **OCP\\AppFramework\\OCSController** base
762764
763765
}
764766
765-
The format parameter works out of the box, no intervention is required.
767+
For ``OCSController`` classes and their methods, :ref:`responders <controller-responders>` can be registered as with any other ``Controller`` method.
768+
The ``OCSController`` class have however automatically two respnders pre-installed:
769+
Both JSON (``application/json``) and XML (``text/xml``) are generated on-the-fly depending on the request by the browser/user.
770+
To select the output format, the format parameter or the ``Accept`` header of the request work out of the box, no intervention is required.
771+
It is adviced to prefer the header generally, as this is the more programmatic way.
766772

767773
In order to make routing work for OCS routes you need to add a separate 'ocs' entry to the routing table in ``appinf/routes.php`` of your app.
768774
Inside these are normal routes.

0 commit comments

Comments
 (0)