um den output type einer agavi action auch nach dem routing zu ändern, kann man innerhalb der action den output type überschreiben.
/**
* assume that 'html' is the standard GET output for this action
* when this action is called via POST you want to change the output type to 'json'
* because on error or success you want to show small messages per json instead full html
*/
public function executeRead(AgaviRequestDataHolder $rd)
{
return 'Input';
}
public function executeWrite(AgaviRequestDataHolder $rd)
{
$this->getContainer()->setOutputType($this->getContext()->getController()->getOutputType('json'));
try
{
// do POST stuff
}
catch(Exception $e)
{
$this->setAttribute('message', $e->getMessage());
return 'Error';
}
return 'Success';
}