Update of /cvsroot/qooxdoo/qooxdoo/source/script/transport
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30866/source/script/transport
Modified Files:
Tag: renderer
QxRequest.js QxResponse.js QxTransport.js
QxXmlHttpTransport.js
Log Message:
Major rework of some internals
Index: QxRequest.js
===================================================================
RCS file: /cvsroot/qooxdoo/qooxdoo/source/script/transport/Attic/QxRequest.js,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** QxRequest.js 19 Jan 2006 13:37:10 -0000 1.1.2.6
--- QxRequest.js 19 Jan 2006 13:56:09 -0000 1.1.2.7
***************
*** 53,58 ****
QxRequest.addProperty({ name : "username", type : QxConst.TYPEOF_STRING });
QxRequest.addProperty({ name : "password", type : QxConst.TYPEOF_STRING });
!
! QxRequest.addProperty({ name : "readyState", type : QxConst.TYPEOF_STRING, possibleValues : [ "prepared", "loading", "complete" ], defaultValue : "prepared" });
--- 53,57 ----
QxRequest.addProperty({ name : "username", type : QxConst.TYPEOF_STRING });
QxRequest.addProperty({ name : "password", type : QxConst.TYPEOF_STRING });
! QxRequest.addProperty({ name : "readyState", type : QxConst.TYPEOF_STRING });
***************
*** 81,85 ****
proto.send = function()
{
- this.debug("sending");
QxRequestQueue.add(this);
};
--- 80,83 ----
Index: QxTransport.js
===================================================================
RCS file: /cvsroot/qooxdoo/qooxdoo/source/script/transport/Attic/QxTransport.js,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** QxTransport.js 19 Jan 2006 13:37:10 -0000 1.1.2.5
--- QxTransport.js 19 Jan 2006 13:56:09 -0000 1.1.2.6
***************
*** 34,39 ****
QxTarget.call(this);
- this.debug("sending");
-
this.setRequest(vRequest);
this.send();
--- 34,37 ----
***************
*** 53,56 ****
--- 51,56 ----
QxTransport.addProperty({ name : "request", type : QxConst.TYPEOF_OBJECT, instance : "QxRequest" });
QxTransport.addProperty({ name : "implementation", type : QxConst.TYPEOF_OBJECT });
+ QxTransport.addProperty({ name : "readyState" });
+
***************
*** 67,72 ****
if (propOldValue)
{
propOldValue.removeEventListener("complete", this._oncomplete, this);
- propOldValue.removeEventListener("changeReadyState", this._onreadystatechange, this);
propOldValue.dispose();
--- 67,73 ----
if (propOldValue)
{
+ propOldValue.removeEventListener("prepared", this._onprepared, this);
+ propOldValue.removeEventListener("loading", this._onloading, this);
propOldValue.removeEventListener("complete", this._oncomplete, this);
propOldValue.dispose();
***************
*** 84,89 ****
propValue.setPassword(vRequest.getPassword());
propValue.addEventListener("complete", this._oncomplete, this);
- propValue.addEventListener("changeReadyState", this._onreadystatechange, this);
propValue.send();
--- 85,91 ----
propValue.setPassword(vRequest.getPassword());
+ propValue.addEventListener("prepared", this._onprepared, this);
+ propValue.addEventListener("loading", this._onloading, this);
propValue.addEventListener("complete", this._oncomplete, this);
propValue.send();
***************
*** 93,96 ****
--- 95,133 ----
};
+ proto._modifyReadyState = function(propValue, propOldValue, propData)
+ {
+ var vRequest = this.getRequest();
+
+ this.debug("readyState [norm]: " + propValue);
+
+ switch(propValue)
+ {
+ case "prepared":
+ break;
+
+ case "loading":
+ break;
+
+ case "complete":
+ if (vRequest.hasEventListeners(QxConst.EVENT_TYPE_COMPLETE))
+ {
+ var vImpl = this.getImplementation();
+ var vResponse = new QxResponse();
+
+ vResponse.setStatusCode(vImpl.getStatusCode());
+ vResponse.setStatusText(vImpl.getStatusText());
+ vResponse.setTextContent(vImpl.getResponseText());
+ vResponse.setXmlContent(vImpl.getResponseXml());
+
+ // TODO: Response Headers
+
+ vRequest.dispatchEvent(new QxDataEvent(QxConst.EVENT_TYPE_COMPLETE, vResponse), true);
+ };
+
+ this.setImplementation(null);
+ };
+
+ return true;
+ };
***************
*** 193,241 ****
*/
! proto._onreadystatechange = function(e)
! {
! this.debug("readyState [norm]: " + e.getNewValue());
!
! switch(e.getNewValue())
! {
! case "prepared":
! break;
!
! case "loading":
! this._onloading(e);
! break;
!
! case "complete":
! this._oncomplete(e);
! break;
! };
};
! proto._onloading = function(e)
! {
! this.debug("loading");
!
!
};
! proto._oncomplete = function(e)
! {
! this.debug("complete");
!
! var vRequest = this.getRequest();
!
! if (vRequest.hasEventListeners(QxConst.EVENT_TYPE_COMPLETE))
! {
! var vValues = e.getNewValue();
! var vResponse = new QxResponse();
!
! vResponse.setStatusCode(vValues.statusCode);
! vResponse.setStatusMessage(vValues.statusMessage);
! vResponse.setXmlContent(vValues.xmlContent);
! vResponse.setTextContent(vValues.textContent);
!
! vRequest.dispatchEvent(new QxDataEvent(QxConst.EVENT_TYPE_COMPLETE, vResponse), true);
! };
!
! this.setImplementation(null);
};
--- 230,242 ----
*/
! proto._onprepared = function(e) {
! this.setReadyState("prepared");
};
! proto._onloading = function(e) {
! this.setReadyState("loading");
};
! proto._oncomplete = function(e) {
! this.setReadyState("complete");
};
Index: QxResponse.js
===================================================================
RCS file: /cvsroot/qooxdoo/qooxdoo/source/script/transport/Attic/QxResponse.js,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** QxResponse.js 19 Jan 2006 12:54:22 -0000 1.1.2.2
--- QxResponse.js 19 Jan 2006 13:56:09 -0000 1.1.2.3
***************
*** 48,52 ****
QxResponse.addProperty({ name : "statusCode", type : QxConst.TYPEOF_NUMBER });
! QxResponse.addProperty({ name : "statusMessage", type : QxConst.TYPEOF_STRING });
QxResponse.addProperty({ name : "textContent", type : QxConst.TYPEOF_STRING });
QxResponse.addProperty({ name : "xmlContent", type : QxConst.TYPEOF_OBJECT });
--- 48,52 ----
QxResponse.addProperty({ name : "statusCode", type : QxConst.TYPEOF_NUMBER });
! QxResponse.addProperty({ name : "statusText", type : QxConst.TYPEOF_STRING });
QxResponse.addProperty({ name : "textContent", type : QxConst.TYPEOF_STRING });
QxResponse.addProperty({ name : "xmlContent", type : QxConst.TYPEOF_OBJECT });
Index: QxXmlHttpTransport.js
===================================================================
RCS file: /cvsroot/qooxdoo/qooxdoo/source/script/transport/Attic/QxXmlHttpTransport.js,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** QxXmlHttpTransport.js 19 Jan 2006 13:37:10 -0000 1.1.2.6
--- QxXmlHttpTransport.js 19 Jan 2006 13:56:09 -0000 1.1.2.7
***************
*** 150,154 ****
The readyState of the current request
*/
! QxXmlHttpTransport.addProperty({ name : "readyState", type : QxConst.TYPEOF_STRING, defaultValue : "prepared" });
--- 150,154 ----
The readyState of the current request
*/
! QxXmlHttpTransport.addProperty({ name : "readyState", type : QxConst.TYPEOF_STRING });
***************
*** 170,174 ****
proto.send = function()
{
! this.debug("sending");
var vRequest = this.getRequest();
--- 170,174 ----
proto.send = function()
{
! this.setReadyState("prepared");
var vRequest = this.getRequest();
***************
*** 190,214 ****
{
this.error("Could not load: " + this.getUrl() + ": " + ex);
! this._dispatchCompleteEvent();
};
};
! proto.dispatchCompleteEvent = function()
! {
! var vRequest = this.getRequest();
!
! if (this.hasEventListeners(QxConst.EVENT_TYPE_COMPLETE))
! {
! this.debug("complete");
!
! this.dispatchEvent(new QxDataEvent(QxConst.EVENT_TYPE_COMPLETE,
! {
! statusCode : vRequest.statusCode,
! statusMessage : vRequest.statusMessage,
! xmlContent : vRequest.responseXML,
! textContent : vRequest.responseText
! }), true);
! };
! };
--- 190,198 ----
{
this.error("Could not load: " + this.getUrl() + ": " + ex);
! this.setReadyState("complete");
};
};
!
***************
*** 230,242 ****
case "prepared":
this.debug("readyState [norm]: prepared");
break;
case "loading":
this.debug("readyState [norm]: loading");
break;
case "complete":
this.debug("readyState [norm]: complete");
! this.dispatchCompleteEvent();
break;
};
--- 214,228 ----
case "prepared":
this.debug("readyState [norm]: prepared");
+ this.createDispatchEvent("prepared");
break;
case "loading":
this.debug("readyState [norm]: loading");
+ this.createDispatchEvent("loading");
break;
case "complete":
this.debug("readyState [norm]: complete");
! this.createDispatchEvent("complete");
break;
};
***************
*** 265,272 ****
switch(vRequest.readyState)
{
- case 0:
- this.setReadyState("prepared");
- break;
-
case 1:
case 2:
--- 251,254 ----
***************
*** 459,463 ****
be made available to the caller.
*/
! proto.getResponseXML = function(vPartial)
{
if ((vPartial ? 3 : 4) <= this.getReadyState()) {
--- 441,445 ----
be made available to the caller.
*/
! proto.getResponseXml = function(vPartial)
{
if ((vPartial ? 3 : 4) <= this.getReadyState()) {
|