Hi,
you definitely should not put your request body in the url.
If you have the POST content in the right place (in request body)
you have two alternatives:
1) Use a file validator like <validator
class="file"><argument>post_file</argument></validator>.
Then you can access the raw json string with
$rd->getFile('post_file')->getContents()
2) Subclass AgaviWebRequest and do something like this:
public function initialize(AgaviContext $context, array
$parameters = array()) {
parent::initialize($context, $parameters);
$rd = $this->getRequestData();
$jsonData = null;
if (($this->getMethod() == "write" ||
$this->getMethod() == "update") &&
isset($_SERVER['CONTENT_TYPE'])
&&
preg_match('#^application/json(;[^;]+)*?$#',
$_SERVER['CONTENT_TYPE'])) {
$jsonStr = "";
if ($this->getMethod() == "update") {
$file = $rd->getFile('put_file'); /* @var $file
AgaviUploadedFile */
$jsonStr = $file->getContents();
}
else {
$jsonStr = file_get_contents('php://input');
}
if (!strlen($jsonStr)) {
throw new Exception('Empty request body');
}
$jsonData = json_decode($jsonStr, true);
}
if ($jsonData) {
$rd->setParameters($jsonData);
}
}
Niklas