php - Different behaviour with and without Symfony's response system -
i'd able manage webdav directories (and reimplement way files read , written) in symfony. found sabredav, framework basic classes required.
my problem is, while it's quite easy webdav server running using sabredav alone, doesn't work when utilize symfony.
without symfony, boils downwards to:
$server = new dav\server($rootdirectory);
$server->exec();
and can utilize cadaver access directory.
more here: http://code.google.com/p/sabredav/wiki/gettingstarted
i tried same in controller symfony, using:
return new response($server->exec());
but reason cadaver doesn't have access folder. guess i'm missing way responses work in symfony, what? sabredav uses own scheme of http requests , responses, if (as presume) symfony doesn't mess superglobal variables such $_server, shouldn't issue.
about requests , responses in symfony: http://symfony.com/doc/current/book/http_fundamentals.html#requests-and-responses-in-symfony
here's did; it's bit slow , there must improve way, i'll create moment: controller.php :
$path=(__dir__.'/../../../../web/public/'); $path=realpath($path); $publicdir= new \myclasses\fs\mydirectory($path); $server = new \sabre\dav\server($publicdir); $server->setbaseuri('/symfony/web/app_dev.php/'); { $syrequest = request::createfromglobals(); $_server=$syrequest->server->all(); $_post=$syrequest->request->all(); } { $sarequest=new \myclasses\http\request($_server,$_post); $resourcestream=false; $sarequest->setbody($syrequest->getcontent($resourcestream),$resourcestream); } { $server->httprequest=$sarequest; $saresponse=new \myclasses\http\response(); $server->httpresponse=$saresponse; $server->exec(); } { $content=ob_get_clean(); } { $syresponse=new response($content,http_response_code(),headers_list()); } homecoming $syresponse;
$server->exec();
doesn't homecoming anything. attempts set headers itself, , stream output php://output
(indeed, built-in request/response system).
if want embed sabredav symfony, proper way solve subclass both sabre\http\request
, sabre\http\response
, , set these in server (setting ->httprequest
, ->httpresponse
properties) before calling ->exec
.
your overridden request/response objects should map symfony's equivalents.
i don't know plenty symfony tell if map cleanly , though, , imagine in practice simpler seek work around symfony's scheme (although architectural standpoint, not proper).
php symfony2 symfony-2.1 webdav
No comments:
Post a Comment