问题的背景----我正在使用jPlayer在ZF2应用程序中播放一些音频文件。jPlayer使用一个ZF2操作作为音频源,运行良好。从控制器操作中,我使用响应对象发送原始响应。简化的代码如下所示:
public function streamAction()
{
// ... left out code to retrieve order and error handling stuff ... //
$response = $this->getResponse();
$path = $this->orderService->getFullPathTo
症状
我想,我搞砸了,因为Mozilla和Google都会产生同样的错误:他们没有收到and服务器发送给他们的全部响应。卷曲永远不会错过,快速滚动反应的最后一行总是“。
原因
原因是,我在更大程度上作出了答复:
sendHeaders(); // is calls sendResponse with a fix header
sendResponse(html_opening_part);
for ( ...scan some data... ) {
sendResponse(the_data);
} // for
sendRespon
下面是我的主计长操作方法。您可以看到,在将数据保存到数据库之前,我传递了一个请求类的param来进行验证
public function store(RoleRequest $request)
{
}
我的请求课在下面。
class RoleRequest extends Request
{
private $Role;
public function __construct(IRole $_role) {
$this->Role = $_role;
}
public function authorize()
{
我正在通过AJAX进行文件上传。但是,我得到了这个错误:
Request header field token is not allowed by Access-Control-Allow-Headers
下面是我上传到的网站的响应头,这些响应头看起来都很好:
HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With, X-Prototype-Version, Content-Disposition, Cache-Control, Content-Type
Access-Control-Allow-Methods: POST,
我正在使用主干从API中获取数据。如果不需要授权,并且当我将授权添加到API中时,就会得到预期的401 --未经授权的响应。
[来自控制台日志:
GET http://localhost:999/api/tasks 401 (Unauthorized)
]
然后,我添加了以下代码,以便为每次调用将承载授权添加到报头:
var backboneSync = Backbone.sync;
Backbone.sync = function (method, model, options) {
/*
* The jQuery `ajax` method includes a