If one needs JSON, XML, etc. als output format, one can use the AcceptableViewModelSelector Controller Plugin or / and (?) alternate rendering / response strategies.
When should the one and when the other (and when a combination) be applied?
Can/should they be combined?
Well, the Strategies are basically listeners. Listeners that give action depending on what kind of Model will be returned from your Controllers actions. If you return a
ViewModelthePhpRendererStrategywill take place. If you return aJsonModel, theJsonStrategywill do it's stuff and if you return aFeedModelit's theFeedStrategydoing it's thing.However the Strategies only apply if they are registered. So if you return a
JsonModelwithout having theJsonStrategyregistered, then nothing will happen.The
AcceptableViewModelSelectorexists to provide an easier access and handling of different ModelFormats depending on the accept header. It helps to make things easier, no more, no less.Strategies, you can also register your own one. There's modules out there that have a PdfStrategy which will render out a PDF-Document if you tell it to.
To tune this down a little to your question:
If that doesn't really cover your question, i'm quite insecure on how to answer you ^^