You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2011/09/14 14:41:31 UTC
svn commit: r1170575 [3/3] - in /myfaces/core/trunk/api/src: assembler/
main/javascript/META-INF/resources/myfaces/_impl/_util/
main/javascript/META-INF/resources/myfaces/_impl/core/
main/javascript/META-INF/resources/myfaces/_impl/xhrCore/ main/javasc...
Added: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/BaseRequest.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/BaseRequest.js?rev=1170575&view=auto
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/BaseRequest.js (added)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/BaseRequest.js Wed Sep 14 12:41:30 2011
@@ -0,0 +1,184 @@
+/**
+ * Abstract Base for all classes which simulate the xhr level2 object
+ * with a different transport
+ *
+ * <h3>Every class inheriting the interface must expose following methods and attributes</h3>
+ *
+ * <ul>
+ * <li>open(method, url, async)</li>
+ * <li>send(formData)</li>
+ * <li>setRequestHeader(key, value)</li>
+ * <li>abort()</li>
+ * <li>onloadstart()</li>
+ * <li>onprogress()</li>
+ * <li>onabort()</li>
+ * <li>onerror()</li>
+ * <li>onload()</li>
+ * <li>ontimeout()</li>
+ * <li>onloadend()</li>
+ * <li>onreadystatechange()</li>
+ * </ul>
+ * <h3>following attributes are supported</h3>
+ * <ul>
+ * <li>async</li>
+ * <li>url</li>
+ * <li>method</li>
+ * <li>timeout</li>
+ * <li>response</li>
+ * <li>responseText</li>
+ * <li>responseXML</li>
+ * <li>status</li>
+ * <li>statusText</li>
+ * </ul>
+ */
+/**
+ * @class
+ * @name BaseRequest
+ * @memberOf myfaces._impl.xhrCore.engine
+ * @extends myfaces._impl.xhrCore._FinalizeableObj
+ * @description
+ * Abstract Base for all classes which simulate the xhr level2 object
+ * with a different transport
+ *
+ * <h3>Every class inheriting the interface must expose following methods and attributes</h3>
+ *
+ * <ul>
+ * <li>open(method, url, async)</li>
+ * <li>send(formData)</li>
+ * <li>setRequestHeader(key, value)</li>
+ * <li>abort()</li>
+ * <li>onloadstart()</li>
+ * <li>onprogress()</li>
+ * <li>onabort()</li>
+ * <li>onerror()</li>
+ * <li>onload()</li>
+ * <li>ontimeout()</li>
+ * <li>onloadend()</li>
+ * <li>onreadystatechange()</li>
+ * </ul>
+ * <h3>following attributes are supported</h3>
+ * <ul>
+ * <li>async</li>
+ * <li>url</li>
+ * <li>method</li>
+ * <li>timeout</li>
+ * <li>response</li>
+ * <li>responseText</li>
+ * <li>responseXML</li>
+ * <li>status</li>
+ * <li>statusText</li>
+ * </ul>
+ */
+myfaces._impl.core._Runtime.extendClass("myfaces._impl.xhrCore.engine.BaseRequest", myfaces._impl.xhrCore._FinalizeableObj,
+ /** @lends myfaces._impl.xhrCore.engine.BaseRequest.prototype */
+ {
+ /*standard attributes*/
+
+ /**
+ * timeout attribute with a timeout for the request in miliseconds
+ */
+ timeout: 0,
+ /**
+ * readonly ready stte attribute
+ */
+ readyState: 0,
+ /**
+ * send method, allowed values POST and GET
+ */
+ method: "POST",
+ /**
+ * the url for the call
+ */
+ url:null,
+ /**
+ * asynchronous request, if set to true then the request happens
+ * asynchronously, if possible.
+ */
+ async:true,
+ /**
+ * read only response object, containing the response as json/dom representation
+ */
+ response: null,
+ /**
+ * read only plain text representation of the response
+ */
+ responseText: null,
+ /**
+ * xml dom readonly representation of the response
+ */
+ responseXML: null,
+ /**
+ * readonly status code of the response
+ */
+ status: null,
+ /**
+ * readonly status text of the response
+ */
+ statusText: null,
+
+ constructor_: function(params) {
+ this._callSuper("constructor_", params);
+ this._initDefaultFinalizableFields();
+
+ this._XHRConst = myfaces._impl.xhrCore.engine.XhrConst;
+ this._Lang.applyArgs(this, params);
+ },
+
+ //open send, abort etc... abstract
+ /**
+ * opens the transport element
+ * @param {String} method transport method allowed values <i>POST</i> and <i>GET</i>
+ * @param {String} url optional url
+ * @param {Boolean}Â async optional param asynchronous transmission if set to true
+ */
+ open: function(method, url, async) {
+ this._implementThis();
+ },
+ /**
+ * send method
+ * @param {Object} formData data to be posted within the request
+ */
+ send: function(formData) {
+ this._implementThis();
+ },
+ /**
+ * appends a key value pair to the request header if possible
+ * @param {String}Â key the key of the request header entry
+ * @param {String}Â value the value for the key
+ */
+ setRequestHeader: function(key, value) {
+ this._implementThis();
+ },
+ /**
+ * aborts the transmission
+ */
+ abort: function() {
+ this._implementThis();
+ },
+
+ //empty implementations for the callback handlers
+ /**
+ * callback once the transmission has started
+ * @param evt
+ */
+ onloadstart: function(evt) {
+ },
+ onprogress: function(evt) {
+ },
+ onabort: function(evt) {
+ },
+ onerror: function(evt) {
+ },
+ onload: function(evt) {
+ },
+ ontimeout: function(evt) {
+ },
+ onloadend: function(evt) {
+ },
+ onreadystatechange: function(evt) {
+ },
+
+ _implementThis: function() {
+ throw Error("the function needs to be implemented");
+ }
+ });
\ No newline at end of file
Added: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/FormData.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/FormData.js?rev=1170575&view=auto
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/FormData.js (added)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/FormData.js Wed Sep 14 12:41:30 2011
@@ -0,0 +1,71 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @class
+ * @name FormData
+ * @memberOf myfaces._impl.xhrCore.engine
+ * @description
+ *
+ * html5 formdata object emulation for the iframe
+ */
+myfaces._impl.core._Runtime.extendClass("myfaces._impl.xhrCore.engine.FormData", Object,
+ /** @lends myfaces._impl.xhrCore.engine.FormData.prototype */
+ {
+ form: null,
+ viewstate: null,
+ _appendedParams: {},
+
+ constructor_: function(form) {
+ this.form = form;
+ },
+
+ append: function(key, value) {
+ this._appendedParams[key] = true;
+ if (this.form) {
+ this._appendHiddenValue(key, value);
+ }
+ },
+
+ _finalize: function() {
+ this._removeAppendedParams();
+ },
+
+ _appendHiddenValue: function(key, value) {
+ if ('undefined' == typeof value) {
+ return;
+ }
+ var _Dom = myfaces._impl._util._Dom;
+ var input = _Dom.createElement("input", {
+ "type": "hidden", "name": key, "style": "display:none", "value": value
+ });
+
+ this.form.appendChild(input);
+ },
+
+ _removeAppendedParams: function() {
+ if (!this.form) return;
+ for (var cnt = this.form.elements.length - 1; cnt >= 0; cnt--) {
+ var elem = this.form.elements[cnt];
+ if (this._appendedParams[elem.name] && elem.type == "hidden") {
+ elem.parentNode.removeChild(elem);
+ delete elem;
+ }
+ }
+ this._appendedParams = {};
+ }
+
+ });
\ No newline at end of file
Added: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/IFrame.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/IFrame.js?rev=1170575&view=auto
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/IFrame.js (added)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/IFrame.js Wed Sep 14 12:41:30 2011
@@ -0,0 +1,283 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @class
+ * @name IFrame
+ * @memberOf myfaces._impl.xhrCore.engine
+ * @extends myfaces._impl.xhrCore.engine.BaseRequest
+ * @description
+ *
+ * wrapper for an iframe transport object with all its differences
+ * it emulates the xhr level2 api
+ */
+myfaces._impl.core._Runtime.extendClass("myfaces._impl.xhrCore.engine.IFrame", myfaces._impl.xhrCore.engine.BaseRequest,
+ /** @lends myfaces._impl.xhrCore.engine.IFrame.prototype */
+ {
+
+
+
+ /*the target frame responsible for the communication*/
+ _frame: null,
+ _requestHeader: null,
+ _aborted: false,
+
+
+ CLS_NAME: "myfaces._impl.xhrCore._IFrameRequest",
+ _FRAME_ID: "_mf_comm_frm",
+
+ /**
+ * constructor which shifts the arguments
+ * to the protected properties of this clas
+ *
+ * @param arguments
+ */
+ constructor_: function(arguments) {
+ //we fetch in the standard arguments
+
+ this._callSuper("constructor", arguments);
+
+ this._initDefaultFinalizableFields();
+ this._requestHeader = {};
+
+ this._XHRConst = myfaces._impl.xhrCore.engine.XhrConst;
+
+ this._Lang.applyArgs(this, arguments);
+ this.readyState = this._XHRConst.READY_STATE_UNSENT;
+ },
+
+ setRequestHeader: function(key, value) {
+ this._requestHeader[key] = value;
+ },
+
+ open: function(method, url, async) {
+
+ this.readyState = this._XHRConst.READY_STATE_OPENED;
+
+ var _RT = myfaces._impl.core._Runtime;
+ var _Lang = this._Lang;
+
+ this._frame = this._createTransportFrame();
+
+ //we append an onload handler to the frame
+ //to cover the starting and loading events,
+ //timeouts cannot be covered in a cross browser way
+
+ //we point our onload handler to the frame, we do not use addOnLoad
+ //because the frame should not have other onload handlers in place
+ if (!_RT.browser.isIE || this._Dom.isDomCompliant()) {
+ this._frame.onload = _Lang.hitch(this, this._callback);
+ } else {
+ //ie has a bug, onload is not settable outside of innerHTML on iframes
+ this._frame.onload_IE = _Lang.hitch(this, this._callback);
+ }
+
+ this.method = method || this.method;
+ this.url = url || this.url;
+ this.async = ('undefined' != typeof async) ? async : this.async;
+
+ var myevt = {};
+ this._addProgressAttributes(myevt, 10, 100);
+ this.onprogress(myevt);
+ },
+
+ send: function(formData) {
+
+ var myevt = {};
+ this._addProgressAttributes(myevt, 20, 100);
+ this.onloadstart(myevt);
+ this.onprogress(myevt);
+
+ var oldTarget = formData.form.target;
+ var oldMethod = formData.form.method;
+ var oldAction = formData.form.action;
+
+ try {
+ //_t._initAjaxParams();
+ for (var key in this._requestHeader) {
+ formData.append(key, this._requestHeader[key]);
+ }
+
+ formData.form.target = this._frame.name;
+ formData.form.method = this.method;
+ if (this.url) {
+ formData.form.action = this.url;
+ }
+ this.readyState = this._XHRConst.READY_STATE_LOADING;
+ this.onreadystatechange(myevt);
+ formData.form.submit();
+ } finally {
+ formData.form.action = oldAction;
+ formData.form.target = oldTarget;
+ formData.form.method = oldMethod;
+
+ formData._finalize();
+ }
+ },
+
+ /*we can implement it, but it will work only on browsers
+ * which have asynchronous iframe loading*/
+ abort: function() {
+ this._aborted = true;
+ this.onabort({});
+ },
+
+ _addProgressAttributes: function(evt, percent, total) {
+ //http://www.w3.org/TR/progress-events/#progressevent
+ evt.lengthComputable = true;
+ evt.loaded = percent;
+ evt.total = total;
+
+ },
+
+ _callback: function() {
+
+ //aborted no further processing
+ if (this._aborted) return;
+ try {
+ var myevt = {};
+
+ this._addProgressAttributes(myevt, 100, 100);
+ this.readyState = this._XHRConst.READY_STATE_DONE;
+ this.onreadystatechange(myevt);
+
+ this.responseText = this._getFrameText();
+ this.responseXML = this._getFrameXml();
+ this.readyState = this._READY_STATE_DONE;
+
+ //TODO status and statusText
+
+ this.onreadystatechange(myevt);
+ this.onloadend();
+
+ if (!this._Lang.isXMLParseError(this.responseXML)) {
+ this.status = 201;
+ this.onload();
+ } else {
+ this.status = 0;
+ //we simulate the request for our xhr call
+ this.onerror();
+ }
+
+ } finally {
+ this._frame = null;
+ }
+ },
+
+ /**
+ * returns the frame text in a browser independend manner
+ */
+ _getFrameDocument: function() {
+
+ //we cover various browsers here, because almost all browsers keep the document in a different
+ //position
+ return this._frame.contentWindow.document || this._frame.contentDocument || this._frame.document;
+ },
+
+ _getFrameText: function() {
+ var framedoc = this._getFrameDocument();
+ //also ie keeps the body in framedoc.body the rest in documentElement
+ var body = framedoc.body || framedoc.documentElement;
+ return body.innerHTML;
+ },
+
+ _clearFrame: function() {
+
+ var framedoc = this._getFrameDocument();
+ var body = framedoc.documentElement || framedoc.body;
+ //ie8 in 7 mode chokes on the innerHTML method
+ //direct dom removal is less flakey and works
+ //over all browsers, but is slower
+ if (myfaces._impl.core._Runtime.browser.isIE) {
+ this._Dom._removeChildNodes(body, false);
+ } else {
+ body.innerHTML = "";
+ }
+ },
+
+ /**
+ * returns the processed xml from the frame
+ */
+ _getFrameXml: function() {
+ var framedoc = this._getFrameDocument();
+ //same situation here, the xml is hosted either in xmlDocument or
+ //is located directly under the frame document
+ return framedoc.XMLDocument || framedoc;
+ },
+
+ _createTransportFrame: function() {
+
+ var _FRM_ID = this._FRAME_ID;
+ var frame = document.getElementById(_FRM_ID);
+ if (frame) return frame;
+ //normally this code should not be called
+ //but just to be sure
+
+ if (this._Dom.isDomCompliant()) {
+ frame = this._Dom.createElement('iframe', {
+ "src": "about:blank",
+ "id": _FRM_ID,
+ "name": _FRM_ID,
+ "type": "content",
+ "collapsed": "true",
+ "style": "display:none"
+ });
+
+ //probably the ie method would work on all browsers
+ //but this code is the safe bet it works on all standards
+ //compliant browsers in a clean manner
+
+ document.body.appendChild(frame);
+ } else { //Now to the non compliant browsers
+ var node = this._Dom.createElement("div", {
+ "style": "display:none"
+ });
+
+ //we are dealing with two well known iframe ie bugs here
+ //first the iframe has to be set via innerHTML to be present
+ //secondly the onload handler is immutable on ie, we have to
+ //use a dummy onload handler in this case and call this one
+ //from the onload handler
+ node.innerHTML = "<iframe id='" + _FRM_ID + "' name='" + _FRM_ID + "' style='display:none;' src='about:blank' type='content' onload='this.onload_IE();' ></iframe>";
+
+ //avoid the ie open tag problem
+ var body = document.body;
+ if (body.firstChild) {
+ body.insertBefore(node, document.body.firstChild);
+ } else {
+ body.appendChild(node);
+ }
+ }
+
+ //helps to for the onload handlers and innerhtml to be in sync again
+ return document.getElementById(_FRM_ID);
+ },
+
+ _startTimeout: function() {
+
+ if (this.timeout == 0) return;
+ this._timeoutTimer = setTimeout(this._Lang.hitch(this, function() {
+ if (this._xhrObject.readyState != this._XHRConst.READY_STATE_DONE) {
+
+ this._aborted = true;
+ clearTimeout(this._timeoutTimer);
+ //we cannot abort an iframe request
+ this.ontimeout({});
+ this._timeoutTimer = null;
+ }
+ }), this.timeout);
+ }
+ });
Added: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/Xhr1.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/Xhr1.js?rev=1170575&view=auto
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/Xhr1.js (added)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/Xhr1.js Wed Sep 14 12:41:30 2011
@@ -0,0 +1,175 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * @class
+ * @name Xhr1
+ * @memberOf myfaces._impl.xhrCore.engine
+ * @extends myfaces._impl.xhrCore.engine.BaseRequest
+ * @description
+ *
+ * wrapper for an xhr level1 object with all its differences
+ * it emulates the xhr level2 api which is way simpler than the level1 api
+ */
+
+myfaces._impl.core._Runtime.extendClass("myfaces._impl.xhrCore.engine.Xhr1", myfaces._impl.xhrCore.engine.BaseRequest,
+ /** @lends myfaces._impl.xhrCore.engine.Xhr1.prototype */
+ {
+
+ _xhrObject: null,
+ _timeoutTimer: null,
+
+ constructor_: function(params) {
+ //the constructor is empty due to the original xhr object not having anything
+
+ this._callSuper("constructor_", params);
+ this._initDefaultFinalizableFields();
+
+ this._XHRConst = myfaces._impl.xhrCore.engine.XhrConst;
+ this._Lang.applyArgs(this, params);
+ },
+
+ // void open(DOMString method, DOMString url, boolean async);
+ open: function(method, url, async) {
+
+ var xhr = this._xhrObject;
+ xhr.onreadystatechange = this._Lang.hitch(this, this.onreadystatechange);
+ this.method = method || this.method;
+ this.url = url || this.url;
+ this.async = ('undefined' != typeof async) ? async : this.async;
+ xhr.open(this.method, this.url, this.async);
+ },
+
+ send: function(formData) {
+
+ var myevt = {};
+
+ this._addProgressAttributes(myevt, 20, 100);
+ this.onloadstart(myevt);
+ this.onprogress(myevt);
+ this._startTimeout();
+ this._xhrObject.send(formData);
+ },
+
+ setRequestHeader: function(key, value) {
+ this._xhrObject.setRequestHeader(key, value);
+ },
+
+ abort: function() {
+
+ this._xhrObject.abort();
+ this.onabort({});
+ },
+
+
+ _addProgressAttributes: function(evt, percent, total) {
+ //http://www.w3.org/TR/progress-events/#progressevent
+ evt.lengthComputable = true;
+ evt.loaded = percent;
+ evt.total = total;
+
+ },
+
+ onreadystatechange: function(evt) {
+ var myevt = evt || {};
+ //we have to simulate the attributes as well
+ var xhr = this._xhrObject;
+ var XHRConst = this._XHRConst;
+ this.readyState = xhr.readyState;
+
+
+ switch (this.readyState) {
+
+ case XHRConst.READY_STATE_OPENED:
+ this._addProgressAttributes(myevt, 10, 100);
+
+ this.onprogress(myevt);
+ break;
+
+ case XHRConst.READY_STATE_HEADERS_RECEIVED:
+ this._addProgressAttributes(myevt, 25, 100);
+
+ this.onprogress(myevt);
+ break;
+
+ case XHRConst.READY_STATE_LOADING:
+ if (this._loadingCalled) break;
+ this._loadingCalled = true;
+ this._addProgressAttributes(myevt, 50, 100);
+
+ this.onprogress(myevt);
+ break;
+
+ case XHRConst.READY_STATE_DONE:
+ this._addProgressAttributes(myevt, 100, 100);
+ //xhr level1 does not have timeout handler
+ if (this._timeoutTimer) {
+ //normally the timeout should not cause anything anymore
+ //but just to make sure
+ window.clearTimeout(this._timeoutTimer);
+ this._timeoutTimer = null;
+ }
+ this._transferRequestValues();
+ this.onprogress(myevt);
+ try {
+ var status = xhr.status;
+ if (status >= XHRConst.STATUS_OK_MINOR && status < XHRConst.STATUS_OK_MAJOR) {
+
+ this.onload(myevt);
+ } else {
+ evt.type = "error";
+ this.onerror(myevt);
+ }
+ } finally {
+ this.onloadend(myevt);
+ }
+ }
+ },
+
+ _transferRequestValues: function() {
+ this._Lang.mixMaps(this, this._xhrObject, true, null,
+ ["responseText","responseXML","status","statusText","response"]);
+ },
+
+ _startTimeout: function() {
+
+ var xhr = this._xhrObject;
+ //some browsers have timeouts in their xhr level 1.x objects implemented
+ //we leverage them whenever they exist
+ if ('undefined' != typeof xhr.timeout) {
+ xhr.timeout = this.timeout;
+ xhr.ontimeout = this.ontimeout;
+ return;
+ }
+
+ if (this.timeout == 0) return;
+ this._timeoutTimer = setTimeout(this._Lang.hitch(this, function() {
+ if (xhr.readyState != this._XHRConst.READY_STATE_DONE) {
+
+ xhr.onreadystatechange = function() {
+ };
+ clearTimeout(this._timeoutTimer);
+ xhr.abort();
+ this.ontimeout({});
+ }
+ }), this.timeout);
+ },
+
+ getXHRObject: function() {
+ return this._xhrObject;
+ }
+ });
\ No newline at end of file
Added: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/XhrConst.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/XhrConst.js?rev=1170575&view=auto
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/XhrConst.js (added)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/XhrConst.js Wed Sep 14 12:41:30 2011
@@ -0,0 +1,41 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @memberOf myfaces._impl.xhrCore
+ * @namespace
+ * @name engine
+ */
+
+/**
+ * @class
+ * @name XhrConst
+ * @memberOf myfaces._impl.xhrCore.engine
+ */
+myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl.xhrCore.engine.XhrConst", Object,
+ /** @lends myfaces._impl.xhrCore.engine.XhrConst.prototype */
+ {
+ READY_STATE_UNSENT: 0,
+ READY_STATE_OPENED: 1,
+ READY_STATE_HEADERS_RECEIVED: 2,
+ READY_STATE_LOADING: 3,
+ READY_STATE_DONE: 4,
+
+ STATUS_OK_MINOR: 200,
+ STATUS_OK_MAJOR: 300,
+
+ constructor_: function() {
+ }
+ });
\ No newline at end of file