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/03/11 22:02:36 UTC
svn commit: r1080757 - in
/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl:
_util/ core/ i18n/ xhrCore/
Author: werpu
Date: Fri Mar 11 21:02:35 2011
New Revision: 1080757
URL: http://svn.apache.org/viewvc?rev=1080757&view=rev
Log:
cummulative commit for following issues:
https://issues.apache.org/jira/browse/MYFACES-3043
https://issues.apache.org/jira/browse/MYFACES-3070
https://issues.apache.org/jira/browse/MYFACES-3071
https://issues.apache.org/jira/browse/MYFACES-3072
https://issues.apache.org/jira/browse/MYFACES-3073
Modified:
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_es.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_nl.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_IFrameRequest.js
myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js Fri Mar 11 21:02:35 2011
@@ -323,8 +323,7 @@ myfaces._impl.core._Runtime.singletonExt
},
- _buildNodesCompliant:
- function(markup) {
+ _buildNodesCompliant: function(markup) {
var dummyPlaceHolder = this.getDummyPlaceHolder(); //document.createElement("div");
dummyPlaceHolder.innerHTML = markup;
return this._Lang.objToArray(dummyPlaceHolder.childNodes);
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js Fri Mar 11 21:02:35 2011
@@ -70,6 +70,9 @@ myfaces._impl.core._Runtime.singletonExt
_Lang: myfaces._impl._util._Lang,
_Dom: myfaces._impl._util._Dom,
+ /*error reporting threshold*/
+ _threshold: "ERROR",
+
/*blockfilter for the passthrough filtering, the attributes given here
* will not be transmitted from the options into the passthrough*/
_BLOCKFILTER: {onerror: true, onevent: true, render: true, execute: true, myfaces: true},
@@ -407,6 +410,7 @@ myfaces._impl.core._Runtime.singletonExt
*/
sendError : function sendError(/*Object*/request, /*Object*/ context, /*String*/ name, /*String*/ serverErrorName, /*String*/ serverErrorMessage) {
var _Lang = myfaces._impl._util._Lang;
+ var UNKNOWN = _Lang.getMessage("UNKNOWN");
var eventData = {};
//we keep this in a closure because we might reuse it for our serverErrorMessage
@@ -414,17 +418,21 @@ myfaces._impl.core._Runtime.singletonExt
return (name && name === myfaces._impl.core.Impl.MALFORMEDXML) ? _Lang.getMessage("ERR_MALFORMEDXML") : "";
};
+
+
+ //by setting unknown values to unknown we can handle cases
+ //better where a simulated context is pushed into the system
eventData.type = this.ERROR;
- eventData.status = name;
- eventData.serverErrorName = serverErrorName;
- eventData.serverErrorMessage = serverErrorMessage;
+ eventData.status = name || UNKNOWN;
+ eventData.serverErrorName = serverErrorName || UNKNOWN;
+ eventData.serverErrorMessage = serverErrorMessage || UNKNOWN;
try {
- eventData.source = context.source;
- eventData.responseCode = request.status;
- eventData.responseText = request.responseText;
- eventData.responseXML = request.responseXML;
+ eventData.source = context.source || UNKNOWN;
+ eventData.responseCode = request.status || UNKNOWN;
+ eventData.responseText = request.responseText || UNKNOWN;
+ eventData.responseXML = request.responseXML || UNKNOWN;
} catch (e) {
// silently ignore: user can find out by examining the event data
}
@@ -445,8 +453,9 @@ myfaces._impl.core._Runtime.singletonExt
finalMessage.push((serverErrorName) ? serverErrorName : "");
finalMessage.push((serverErrorMessage) ? serverErrorMessage : "");
finalMessage.push(malFormedMessage());
-
- defaultErrorOutput(finalMessage.join("-") + _Lang.getMessage("MSG_DEV_MODE"));
+ finalMessage.push("\n\n");
+ finalMessage.push( _Lang.getMessage("MSG_DEV_MODE"));
+ defaultErrorOutput(finalMessage.join(""));
}
},
@@ -456,11 +465,14 @@ myfaces._impl.core._Runtime.singletonExt
sendEvent : function sendEvent(/*Object*/request, /*Object*/ context, /*event name*/ name) {
var _Lang = myfaces._impl._util._Lang;
var eventData = {};
+ var UNKNOWN = _Lang.getMessage("UNKNOWN");
+
eventData.type = this.EVENT;
eventData.status = name;
eventData.source = context.source;
+
if (name !== this.BEGIN) {
try {
@@ -469,7 +481,7 @@ myfaces._impl.core._Runtime.singletonExt
try {
return value[key]
} catch (e) {
- return "unkown";
+ return UNKNOWN;
}
};
@@ -500,6 +512,9 @@ myfaces._impl.core._Runtime.singletonExt
/**
* processes the ajax response if the ajax request completes successfully
+ * this is the case for non queued outside calls which are triggered by calling response
+ * themselves and hence the case according to the spec
+ *
* @param {Object} request (xhrRequest) the ajax request!
* @param {Object} context (Map) context map keeping context data not being passed down over
* the request boundary but kept on the client
@@ -622,5 +637,47 @@ myfaces._impl.core._Runtime.singletonExt
}
return true;
+ },
+
+ /**
+ * error handler behavior called internally
+ * and only into the impl it takes care of the
+ * internal message transformation to a myfaces internal error
+ * and then uses the standard send error mechanisms
+ * also a double error logging prevention is done as well
+ *
+ * @param request the request currently being processed
+ * @param context the context affected by this error
+ * @param sourceClass the sourceclass throwing the error
+ * @param func the function throwing the error
+ * @param exception the exception being thrown
+ */
+ stdErrorHandler: function(request, context, sourceClass, func, exception) {
+
+ var _Lang = myfaces._impl._util._Lang;
+ var exProcessed = _Lang.isExceptionProcessed(exception);
+ try {
+ //newer browsers do not allow to hold additional values on native objects like exceptions
+ //we hence capsule it into the request, which is gced automatically
+ //on ie as well, since the stdErrorHandler usually is called between requests
+ //this is a valid approach
+
+ if (this._threshold == "ERROR" && !exProcessed) {
+ this.sendError(request, context, this.CLIENT_ERROR, exception.name,
+ "MyFaces ERROR:" + this._Lang.createErrorMsg(sourceClass, func, exception));
+ }
+ } finally {
+
+ //we forward the exception, just in case so that the client
+ //will receive it in any way
+ try {
+ if (!exProcessed) {
+ _Lang.setExceptionProcessed(exception);
+ }
+ } catch(e) {
+
+ }
+ throw exception;
+ }
}
});
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js Fri Mar 11 21:02:35 2011
@@ -57,6 +57,57 @@ if (!myfaces._impl.core._Runtime) {
*/
_T._classReplacementCnt = 0;
+ /*cascaded eval methods depending upon the browser*/
+
+ /*legacy browser IE*/
+ _T._evalExecScript = function(code) {
+ //execScript definitely only for IE otherwise we might have a custom
+ //window extension with undefined behavior on our necks
+ //window.execScript does not return anything
+ //on htmlunit it return "null object"
+ var ret = window.execScript(code);
+ if ('undefined' != typeof ret && ret == "null" /*htmlunit bug*/) {
+ return null;
+ }
+ return ret;
+ };
+
+ /**
+ * flakey head appendix method which does not work in the correct
+ * order or at all for all modern browsers
+ * but seems to be the only method which works on blackberry correctly
+ * hence we are going to use it as fallback
+ *
+ * @param code the code part to be evaled
+ */
+ _T._evalBBOld = function(code) {
+ var location = document.getElementsByTagName("head")[0] || document.documentElement;
+ var placeHolder = document.createElement("script");
+ placeHolder.type = "text/javascript";
+ placeHolder.text = code;
+ location.insertBefore(placeHolder, location.firstChild);
+ location.removeChild(placeHolder);
+ return null;
+ };
+
+ _T._standardGlobalEval = function(code) {
+ //fix which works in a cross browser way
+ //we used to scope an anonymous function
+ //but I think this is better
+ //the reason is firefox applies a wrong scope
+ //if we call eval by not scoping
+
+ var gEval = function () {
+
+ var ret = window.eval.call(window, code);
+ if ('undefined' == typeof ret) return null;
+ return ret;
+ };
+ var ret = gEval();
+ if ('undefined' == typeof ret) return null;
+ return ret;
+ };
+
/**
* global eval on scripts
*
@@ -73,41 +124,15 @@ if (!myfaces._impl.core._Runtime) {
_T.globalEval = function(code) {
//TODO add a config param which allows to evaluate global scripts even if the call
//is embedded in an iframe
- if (window.execScript) {
- //execScript definitely only for IE otherwise we might have a custom
- //window extension with undefined behavior on our necks
- //window.execScript does not return anything
- //on htmlunit it return "null object"
- var ret = window.execScript(code);
- if ('undefined' != typeof ret && ret == "null" /*htmlunit bug*/) {
- return null;
- }
- return ret;
- } else if (window.eval) {
-
- //fix which works in a cross browser way
- //we used to scope an anonymous function
- //but I think this is better
- //the reason is firefox applies a wrong scope
- //if we call eval by not scoping
-
- if (!_T.browser.isBlackBerry || _T.browser.isBlackBerry >= 6) {
- var gEval = function () {
-
- var ret = window.eval.call(window, code);
- if ('undefined' == typeof ret) return null;
- return ret;
- };
- var ret = gEval();
- if ('undefined' == typeof ret) return null;
- return ret;
- } else {
- //blackberry 5- only understands the flaky head method
- //which fails on literally all newer browsers one way or the other
- return _T._globalEvalHeadAppendixMethod(code);
- }
- //we scope the call in window
-
+ //We lazy init the eval type upon the browsers
+ //capabilities
+ if ('undefined' == typeof _T._evalType) {
+ _T._evalType = window.excScript ? "evalExecScript" : null;
+ _T._evalType = !_T._evalType && window.eval && (!_T.browser.isBlackBerry || _T.browser.isBlackBerry >= 6) ? "_standardGlobalEval" : null;
+ _T._evalType = (window.eval && !_T._evalType) ? _evalBBOld : null;
+ }
+ if (_T._evalType) {
+ return _T[_T._evalType](code);
}
//we probably have covered all browsers, but this is a safety net which might be triggered
//by some foreign browser which is not covered by the above cases
@@ -116,24 +141,6 @@ if (!myfaces._impl.core._Runtime) {
};
/**
- * flakey head appendix method which does not work in the correct
- * order or at all for all modern browsers
- * but seems to be the only method which works on blackberry correctly
- * hence we are going to use it as fallback
- *
- * @param code the code part to be evaled
- */
- _T._globalEvalHeadAppendixMethod = function(code) {
- var location = document.getElementsByTagName("head")[0] || document.documentElement;
- var placeHolder = document.createElement("script");
- placeHolder.type = "text/javascript";
- placeHolder.text = code;
- location.insertBefore(placeHolder, location.firstChild);
- location.removeChild(placeHolder);
- return null;
- };
-
- /**
* applies an object to a namespace
* basically does what bla.my.name.space = obj does
* note we cannot use var myNameSpace = fetchNamespace("my.name.space")
@@ -435,39 +442,46 @@ if (!myfaces._impl.core._Runtime) {
* @param {String} type the type of the script
* @param {Boolean} defer defer true or false, same as the javascript tag defer param
* @param {String} charSet the charset under which the script has to be loaded
+ * @param {Boolean} async tells whether the script can be asynchronously loaded or not, currently
+ * not used
*/
- _T.loadScriptEval = function(src, type, defer, charSet) {
+ _T.loadScriptEval = function(src, type, defer, charSet, async) {
var xhr = _T.getXHRObject();
- xhr.open("GET", src, false);
+ xhr.open("GET", src, async);
if (charSet) {
xhr.setRequestHeader("Content-Type", "application/x-javascript; charset:" + charSet);
}
- xhr.send(null);
- //since we are synchronous we do it after not with onReadyStateChange
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- //defer also means we have to process after the ajax response
- //has been processed
- //we can achieve that with a small timeout, the timeout
- //triggers after the processing is done!
- if (!defer) {
- _T.globalEval(xhr.responseText.replace("\n", "\r\n") + "\r\n//@ sourceURL=" + src);
+ xhr.onreadystatechange = function() {
+ //since we are synchronous we do it after not with onReadyStateChange
+
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ //defer also means we have to process after the ajax response
+ //has been processed
+ //we can achieve that with a small timeout, the timeout
+ //triggers after the processing is done!
+ if (!defer) {
+ _T.globalEval(xhr.responseText.replace("\n", "\r\n") + "\r\n//@ sourceURL=" + src);
+ } else {
+ //TODO not ideal we maybe ought to move to something else here
+ //but since it is not in use yet, it is ok
+ setTimeout(function() {
+ _T.globalEval(xhr.responseText + "\r\n//@ sourceURL=" + src);
+ }, 1);
+ }
} else {
- //TODO not ideal we maybe ought to move to something else here
- //but since it is not in use yet, it is ok
- setTimeout(function() {
- _T.globalEval(xhr.responseText + "\r\n//@ sourceURL=" + src);
- }, 1);
+ throw Error(xhr.responseText);
}
- } else {
- throw Error(xhr.responseText);
}
- } else {
- throw Error("Loading of script " + src + " failed ");
+ /* else {
+ throw Error("Loading of script " + src + " failed ");
+ }*/
}
+ xhr.send(null);
+
};
/**
@@ -479,7 +493,7 @@ if (!myfaces._impl.core._Runtime) {
* @param {Boolean} defer defer true or false, same as the javascript tag defer param
* @param {String} charSet the charset under which the script has to be loaded
*/
- _T.loadScriptByBrowser = function(src, type, defer, charSet) {
+ _T.loadScriptByBrowser = function(src, type, defer, charSet, async) {
//if a head is already present then it is safer to simply
//use the body, some browsers prevent head alterations
//after the first initial rendering
@@ -488,9 +502,6 @@ if (!myfaces._impl.core._Runtime) {
//the rest can be finely served with body
var d = _T.browser;
var position = "head"
- //if(!d.isIE || d.isIE >= 8) {
- // position = document.getElementsByTagName("body").length ? "body" : "head";
- //}
try {
var holder = document.getElementsByTagName(position)[0];
@@ -500,6 +511,7 @@ if (!myfaces._impl.core._Runtime) {
html.appendChild(holder);
}
var script = document.createElement("script");
+
script.type = type || "text/javascript";
script.src = src;
if (charSet) {
@@ -508,14 +520,12 @@ if (!myfaces._impl.core._Runtime) {
if (defer) {
script.defer = defer;
}
-
- //fix for the white page issue
- // if(_T.browser.isIE && _T.browser.isIE < 7) {
- // holder.insertBefore( script, holder.firstChild );
- // holder.removeChild( script );
- // } else {
+ /*html5 capable browsers can deal with script.async for
+ * proper head loading*/
+ if ('undefined' != typeof script.async) {
+ script.async = async;
+ }
holder.appendChild(script);
- // }
} catch (e) {
//in case of a loading error we retry via eval
@@ -525,16 +535,16 @@ if (!myfaces._impl.core._Runtime) {
return true;
};
- _T.loadScript = function(src, type, defer, charSet) {
+ _T.loadScript = function(src, type, defer, charSet, async) {
//the chrome engine has a nasty javascript bug which prevents
//a correct order of scripts being loaded
//if you use script source on the head, we have to revert
//to xhr+ globalEval for those
- if (!_T.browser.isFF) {
+ if (!_T.browser.isFF && !_T.browser.isWebkit && !_T.browser.isOpera >= 10) {
_T.loadScriptEval(src, type, defer, charSet);
} else {
//only firefox keeps the order, sorry ie...
- _T.loadScriptByBrowser(src, type, defer, charSet)
+ _T.loadScriptByBrowser(src, type, defer, charSet, async);
}
};
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js Fri Mar 11 21:02:35 2011
@@ -16,33 +16,33 @@
if (!window.jsf) {
var _ls = myfaces._impl.core._Runtime.loadScript;
- _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_de.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_nl.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_es.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_it.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_fr.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_ru.js']}", null, null, "UTF-8");
+ _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_de.js']}", null, null, "UTF-8", true);
+ _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_nl.js']}", null, null, "UTF-8", true);
+ _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_es.js']}", null, null, "UTF-8", true);
+ _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_it.js']}", null, null, "UTF-8", true);
+ _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_fr.js']}", null, null, "UTF-8", true);
+ _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_ru.js']}", null, null, "UTF-8", true);
- _ls("#{resource['org.apache.myfaces.core.impl.util:_Lang.js']}", null, null, "UTF-8");
+ _ls("#{resource['org.apache.myfaces.core.impl.util:_Lang.js']}", null, null, "UTF-8", false);
- _ls("#{resource['org.apache.myfaces.core.impl.util:_ExtLang.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.util:_UnitTest.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.util:_Queue.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.util:_ListenerQueue.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.util:_Dom.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.util:_HtmlStripper.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.util:_OamSubmit.js']}", null, null, "UTF-8");
+ _ls("#{resource['org.apache.myfaces.core.impl.util:_ExtLang.js']}", null, null, "UTF-8", true);
+ _ls("#{resource['org.apache.myfaces.core.impl.util:_UnitTest.js']}", null, null, "UTF-8", true);
+ _ls("#{resource['org.apache.myfaces.core.impl.util:_Queue.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.util:_ListenerQueue.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.util:_Dom.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.util:_HtmlStripper.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.util:_OamSubmit.js']}", null, null, "UTF-8", false);
- _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_FinalizeableObj.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxUtils.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxRequestQueue.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_BaseRequest.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxRequest.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_IFrameRequest.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxResponse.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_Transports.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.impl.core:Impl.js']}", null, null, "UTF-8");
- _ls("#{resource['org.apache.myfaces.core.api:jsf.js']}", null, null, "UTF-8");
+ _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_FinalizeableObj.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxUtils.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxRequestQueue.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_BaseRequest.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxRequest.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_IFrameRequest.js']}", null, null, "UTF-8", true);
+ _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxResponse.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_Transports.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.impl.core:Impl.js']}", null, null, "UTF-8", false);
+ _ls("#{resource['org.apache.myfaces.core.api:jsf.js']}", null, null, "UTF-8", false);
}
\ No newline at end of file
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages.js Fri Mar 11 21:02:35 2011
@@ -72,6 +72,9 @@ myfaces._impl.core._Runtime.extendClass(
ERR_PPR_UNKNOWNCID: "{0}: Unknown Html-Component-ID: {1}",
ERR_NO_VIEWROOTATTR: "{0}: Changing of ViewRoot attributes is not supported",
ERR_NO_HEADATTR: "{0}: Changing of Head attributes is not supported",
- ERR_RED_URL: "{0}: Redirect without url"
+ ERR_RED_URL: "{0}: Redirect without url",
+ ERR_REQ_FAILED_UNKNOWN: "Request failed with unknown status",
+ ERR_REQU_FAILED: "Request failed with status {0} and reason {1}",
+ UNKNOWN: "UNKNOWN"
});
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_de.js Fri Mar 11 21:02:35 2011
@@ -85,6 +85,10 @@ myfaces._impl.core._Runtime.extendClass(
ERR_PPR_UNKNOWNCID: "{0}: Unbekannte Html-Komponenten-ID: {1}",
ERR_NO_VIEWROOTATTR: "{0}: Ãnderung von ViewRoot Attributen ist nicht erlaubt",
ERR_NO_HEADATTR: "{0}: Ãnderung von Head Attributen ist nicht erlaubt",
- ERR_RED_URL: "{0}: Redirect ohne URL"
+ ERR_RED_URL: "{0}: Redirect ohne URL",
+
+ ERR_REQ_FAILED_UNKNOWN: "Anfrage mit unbekanntem Status fehlgeschlagen",
+ ERR_REQU_FAILED: "Anfrage mit Status {0} and Ursache {1} fehlgeschlagen",
+ UNKNOWN: "Unbekannt"
});
\ No newline at end of file
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_es.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_es.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_es.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_es.js Fri Mar 11 21:02:35 2011
@@ -26,52 +26,56 @@ myfaces._impl.core._Runtime.extendClass(
MSG_TEST: "Mensajeprueba",
- /*Messages*/
- MSG_DEV_MODE: "Aviso. Este mensaje solo se envia porque el 'Project Stage' es 'Development' y no hay otros 'listeners' de errores registrados.",
- MSG_AFFECTED_CLASS: "Clase Afectada:",
- MSG_AFFECTED_METHOD: "Mtodo Afectado:",
-
- MSG_ERROR_NAME: "Nombre del Error:",
- MSG_ERROR_MESSAGE: "Nombre del Error:",
-
- MSG_ERROR_DESC: "Descripcin del Error:",
- MSG_ERROR_NO: "Nmero de Error:",
- MSG_ERROR_LINENO: "Nmero de Lnea del Error:",
-
- /*Errors and messages*/
- ERR_FORM: "El formulario de origen no ha podido ser determinado, debido a que el elemento no forma parte de un formulario o hay diversos formularios con elementos usando el mismo nombre o identificador. Parando el procesamiento de Ajax.",
- ERR_VIEWSTATE: "jsf.viewState: el valor del parmetro no es de tipo 'form'!",
- ERR_TRANSPORT: "El tipo de transporte {0} no existe",
- ERR_EVT_PASS: "un evento debe ser transmitido (sea null o no definido)",
- ERR_CONSTRUCT: "Partes de la respuesta no pudieron ser recuperadas cuando construyendo los datos del evento: {0} ",
- ERR_MALFORMEDXML: "La respuesta del servidor no ha podido ser interpretada. El servidor ha devuelto una respuesta que no es xml !",
- ERR_SOURCE_FUNC: "el origen no puede ser una funcin (probablemente 'source' y evento no han sido definidos o son 'null'",
- ERR_EV_OR_UNKNOWN: "Un objeto de tipo evento o desconocido debe ser pasado como segundo parmetro",
- ERR_SOURCE_NOSTR: "el origen no puede ser 'string'",
- ERR_SOURCE_DEF_NULL: "el origen debe haber sido definido o ser 'null'",
-
- //_Lang.js
- ERR_MUST_STRING: "{0}: {1} namespace debe ser de tipo String",
- ERR_REF_OR_ID: "{0}: {1} una referencia a un nodo o identificador tiene que ser pasada",
- ERR_PARAM_GENERIC: "{0}: el parmetro {1} tiene que ser de tipo {2}",
- ERR_PARAM_STR: "{0}: el parmetro {1} tiene que ser de tipo string",
- ERR_PARAM_STR_RE: "{0}: el parmetro {1} tiene que ser de tipo string o una expresin regular",
- ERR_PARAM_MIXMAPS: "{0}: han de ser pasados tanto un origen como un destino",
- ERR_MUST_BE_PROVIDED: "{0}: {1} y {2} deben ser pasados",
- ERR_MUST_BE_PROVIDED1: "{0}: {1} debe estar definido",
-
- ERR_REPLACE_EL: "replaceElements invocado mientras que evalNodes no es un an array",
- ERR_EMPTY_RESPONSE: "{0}: ÁLa respuesta no puede ser de tipo 'null' o vaca!",
- ERR_ITEM_ID_NOTFOUND: "{0}: el elemento con identificador {1} no ha sido encontrado",
- ERR_PPR_IDREQ: "{0}: Error en PPR Insert, 'id' debe estar presente",
- ERR_PPR_INSERTBEFID: "{0}: Error in PPR Insert, antes de 'id' o despus de 'id' deben estar presentes",
- ERR_PPR_INSERTBEFID_1: "{0}: Error in PPR Insert, antes de nodo con id {1} no existe en el documento",
- ERR_PPR_INSERTBEFID_2: "{0}: Error in PPR Insert, despus de nodo con id {1} no existe en el documento",
-
- ERR_PPR_DELID: "{0}: Error durante borrado, id no presente en xml",
- ERR_PPR_UNKNOWNCID: "{0}: Desconocido Html-Component-ID: {1}",
- ERR_NO_VIEWROOTATTR: "{0}: El cambio de atributos de ViewRoot attributes no es posible",
- ERR_NO_HEADATTR: "{0}: El cambio de los atributos de Head attributes no es posible",
- ERR_RED_URL: "{0}: Redireccin sin url"
+ /*Messages*/
+ MSG_DEV_MODE: "Aviso. Este mensaje solo se envia porque el 'Project Stage' es 'Development' y no hay otros 'listeners' de errores registrados.",
+ MSG_AFFECTED_CLASS: "Clase Afectada:",
+ MSG_AFFECTED_METHOD: "Mtodo Afectado:",
+
+ MSG_ERROR_NAME: "Nombre del Error:",
+ MSG_ERROR_MESSAGE: "Nombre del Error:",
+
+ MSG_ERROR_DESC: "Descripcin del Error:",
+ MSG_ERROR_NO: "Nmero de Error:",
+ MSG_ERROR_LINENO: "Nmero de Lnea del Error:",
+
+ /*Errors and messages*/
+ ERR_FORM: "El formulario de origen no ha podido ser determinado, debido a que el elemento no forma parte de un formulario o hay diversos formularios con elementos usando el mismo nombre o identificador. Parando el procesamiento de Ajax.",
+ ERR_VIEWSTATE: "jsf.viewState: el valor del parmetro no es de tipo 'form'!",
+ ERR_TRANSPORT: "El tipo de transporte {0} no existe",
+ ERR_EVT_PASS: "un evento debe ser transmitido (sea null o no definido)",
+ ERR_CONSTRUCT: "Partes de la respuesta no pudieron ser recuperadas cuando construyendo los datos del evento: {0} ",
+ ERR_MALFORMEDXML: "La respuesta del servidor no ha podido ser interpretada. El servidor ha devuelto una respuesta que no es xml !",
+ ERR_SOURCE_FUNC: "el origen no puede ser una funcin (probablemente 'source' y evento no han sido definidos o son 'null'",
+ ERR_EV_OR_UNKNOWN: "Un objeto de tipo evento o desconocido debe ser pasado como segundo parmetro",
+ ERR_SOURCE_NOSTR: "el origen no puede ser 'string'",
+ ERR_SOURCE_DEF_NULL: "el origen debe haber sido definido o ser 'null'",
+
+ //_Lang.js
+ ERR_MUST_STRING: "{0}: {1} namespace debe ser de tipo String",
+ ERR_REF_OR_ID: "{0}: {1} una referencia a un nodo o identificador tiene que ser pasada",
+ ERR_PARAM_GENERIC: "{0}: el parmetro {1} tiene que ser de tipo {2}",
+ ERR_PARAM_STR: "{0}: el parmetro {1} tiene que ser de tipo string",
+ ERR_PARAM_STR_RE: "{0}: el parmetro {1} tiene que ser de tipo string o una expresin regular",
+ ERR_PARAM_MIXMAPS: "{0}: han de ser pasados tanto un origen como un destino",
+ ERR_MUST_BE_PROVIDED: "{0}: {1} y {2} deben ser pasados",
+ ERR_MUST_BE_PROVIDED1: "{0}: {1} debe estar definido",
+
+ ERR_REPLACE_EL: "replaceElements invocado mientras que evalNodes no es un an array",
+ ERR_EMPTY_RESPONSE: "{0}: ÁLa respuesta no puede ser de tipo 'null' o vaca!",
+ ERR_ITEM_ID_NOTFOUND: "{0}: el elemento con identificador {1} no ha sido encontrado",
+ ERR_PPR_IDREQ: "{0}: Error en PPR Insert, 'id' debe estar presente",
+ ERR_PPR_INSERTBEFID: "{0}: Error in PPR Insert, antes de 'id' o despus de 'id' deben estar presentes",
+ ERR_PPR_INSERTBEFID_1: "{0}: Error in PPR Insert, antes de nodo con id {1} no existe en el documento",
+ ERR_PPR_INSERTBEFID_2: "{0}: Error in PPR Insert, despus de nodo con id {1} no existe en el documento",
+
+ ERR_PPR_DELID: "{0}: Error durante borrado, id no presente en xml",
+ ERR_PPR_UNKNOWNCID: "{0}: Desconocido Html-Component-ID: {1}",
+ ERR_NO_VIEWROOTATTR: "{0}: El cambio de atributos de ViewRoot attributes no es posible",
+ ERR_NO_HEADATTR: "{0}: El cambio de los atributos de Head attributes no es posible",
+ ERR_RED_URL: "{0}: Redireccin sin url",
+
+ ERR_REQ_FAILED_UNKNOWN: "La peticin ha fallado con estado desconocido",
+ ERR_REQU_FAILED: "La peticin ha fallado con estado {0} y razn {1}",
+ UNKNOWN: "DESCONOCIDO"
});
\ No newline at end of file
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_nl.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_nl.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_nl.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/i18n/Messages_nl.js Fri Mar 11 21:02:35 2011
@@ -25,7 +25,7 @@ myfaces._impl.core._Runtime.extendClass(
/*Messages*/
MSG_DEV_MODE: "Opmerking, dit bericht is enkel gestuurd omdat het project stadium develoment is en er geen " +
- "andere listeners zijn geconfigureerd.",
+ "andere listeners zijn geconfigureerd.",
MSG_AFFECTED_CLASS: "Betrokken Klasse:",
MSG_AFFECTED_METHOD: "Betrokken Methode:",
@@ -38,7 +38,7 @@ myfaces._impl.core._Runtime.extendClass(
/*Errors and messages*/
ERR_FORM: "De doel form kon niet bepaald worden, ofwel omdat het element niet tot een form behoort, ofwel omdat er verschillende forms zijn met 'named element' met dezelfde identifier of naam, ajax verwerking is gestopt.",
- ERR_VIEWSTATE: "jsf.viewState: param waarde is niet van het type form!",
+ ERR_VIEWSTATE: "jsf.viewState: param waarde is niet van het type form!",
ERR_TRANSPORT: "Transport type {0} bestaat niet",
ERR_EVT_PASS: "een event moet opgegegevn worden (ofwel een event object null of undefined) ",
ERR_CONSTRUCT: "Delen van het antwoord konden niet opgehaald worden bij het aanmaken van de event data: {0} ",
@@ -70,6 +70,10 @@ myfaces._impl.core._Runtime.extendClass(
ERR_PPR_UNKNOWNCID: "{0}: Onbekende Html-Component-ID: {1}",
ERR_NO_VIEWROOTATTR: "{0}: Wijzigen van ViewRoot attributen is niet ondersteund",
ERR_NO_HEADATTR: "{0}: Wijzigen van Head attributen is niet ondersteund",
- ERR_RED_URL: "{0}: Redirect zonder url"
+ ERR_RED_URL: "{0}: Redirect zonder url",
+
+ ERR_REQ_FAILED_UNKNOWN: "Request mislukt met onbekende status",
+ ERR_REQU_FAILED: "Request mislukt met status {0} en reden {1}",
+ UNKNOWN: "ONBEKEND"
});
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js Fri Mar 11 21:02:35 2011
@@ -41,7 +41,6 @@ myfaces._impl.core._Runtime.extendClass(
*/
constructor_: function(arguments) {
-
try {
this._callSuper("constructor", arguments);
/*namespace remapping for readability*/
@@ -57,7 +56,7 @@ myfaces._impl.core._Runtime.extendClass(
this._ajaxUtil = new myfaces._impl.xhrCore._AjaxUtils(this._onException, this._onWarning);
} catch (e) {
//_onError
- this._onException(this._context, "myfaces._impl.xhrCore._AjaxRequest", "constructor", e);
+ this._onException(this._xhr, this._context, "myfaces._impl.xhrCore._AjaxRequest", "constructor", e);
}
},
@@ -98,13 +97,13 @@ myfaces._impl.core._Runtime.extendClass(
var targetURL;
if (typeof this._sourceForm.elements["javax.faces.encodedURL"] == 'undefined') {
- targetURL = this._sourceForm.action;
+ targetURL = this._sourceForm.action;
} else {
- targetURL = this._sourceForm.elements["javax.faces.encodedURL"].value;
+ targetURL = this._sourceForm.elements["javax.faces.encodedURL"].value;
}
-
+
this._xhr.open(this._ajaxType, targetURL +
- ((this._ajaxType == "GET")? "?"+this._requestParameters.makeFinal():"")
+ ((this._ajaxType == "GET") ? "?" + this._requestParameters.makeFinal() : "")
, true);
var contentType = this._contentType;
@@ -116,13 +115,13 @@ myfaces._impl.core._Runtime.extendClass(
this._xhr.setRequestHeader(this._HEAD_FACES_REQ, this._VAL_AJAX);
this._xhr.onreadystatechange = this._Lang.hitch(this, this.callback);
- var _Impl = myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
- _Impl.sendEvent(this._xhr, this._context, myfaces._impl.core.Impl.BEGIN);
+ var _Impl = this._getImpl();
+ _Impl.sendEvent(this._xhr, _Impl.BEGIN);
this._preSend();
try {
- this._xhr.send((this._ajaxType != "GET")? this._requestParameters.makeFinal():null);
+ this._xhr.send((this._ajaxType != "GET") ? this._requestParameters.makeFinal() : null);
} finally {
this._postSend();
}
@@ -146,22 +145,22 @@ myfaces._impl.core._Runtime.extendClass(
//we unify the api, there must be always a request passed to the external function
//and always a context, no matter what
this._Lang.hitch(this,
- function() {
- //the hitch has to be done due to the setTimeout refocusing the scope of this
- //to window
- try {
- _req.onreadystatechange = function() {
- };
-
- //to avoid malformed whatever, we have
- //the timeout covered already on the _onTimeout function
- _req.abort();
- this._onTimeout(_req, _context);
- } catch (e) {
- alert(e);
- } finally {
- }
- })
+ function() {
+ //the hitch has to be done due to the setTimeout refocusing the scope of this
+ //to window
+ try {
+ _req.onreadystatechange = function() {
+ };
+
+ //to avoid malformed whatever, we have
+ //the timeout covered already on the _onTimeout function
+ _req.abort();
+ this._onTimeout(_req, _context);
+ } catch (e) {
+ alert(e);
+ } finally {
+ }
+ })
, this._timeout);
}
},
@@ -171,9 +170,9 @@ myfaces._impl.core._Runtime.extendClass(
* triggered by RequestQueue
*/
callback : function() {
-
+
try {
- var _Impl = myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
+ var _Impl = this._getImpl();
if (this._xhr.readyState == this._READY_STATE_DONE) {
if (this._timeoutId) {
@@ -182,18 +181,15 @@ myfaces._impl.core._Runtime.extendClass(
window.clearTimeout(this._timeoutId);
this._timeoutId = null;
}
- this._onDone(this._xhr, this._context);
+ this._onDone(this);
if (this._xhr.status >= this._STATUS_OK_MINOR && this._xhr.status < this._STATUS_OK_MAJOR) {
- this._onSuccess(this._xhr, this._context);
+ this._onSuccess();
} else {
- this._onError(this._xhr, this._context);
+ this._onError();
}
}
} catch (e) {
- if (this._onException)
- this._onException(this._xhr, this._context, "myfaces._impl.xhrCore._AjaxRequest", "callback", e);
- else
- alert(e.toString());
+ this._onException(this._xhr, this._context, "myfaces._impl.xhrCore._AjaxRequest", "callback", e);
} finally {
//final cleanup to terminate everything
this._Lang.clearExceptionProcessed();
@@ -203,10 +199,13 @@ myfaces._impl.core._Runtime.extendClass(
this._callSuper("_finalize");
}
-
}
},
+
+
+
+
/*
* various lifecycle callbacks which can be used by differing AjaxRequest impls
* (namely level 1.5 (Mozilla XHR) and level 2 (html5 xhr) to run special initialisation code
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js Fri Mar 11 21:02:35 2011
@@ -22,6 +22,7 @@ myfaces._impl.core._Runtime.extendClass(
*/
_curReq : null,
+
/**
* the standard constructur of our class
*/
@@ -34,6 +35,7 @@ myfaces._impl.core._Runtime.extendClass(
* @param {Object} request (myfaces._impl.xhrCore._AjaxRequest) request to send
*/
enqueue : function(request) {
+
if (typeof request._delay == "number") {
this.clearDelayTimeout();
var _Lang = myfaces._impl._util._Lang;
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js Fri Mar 11 21:02:35 2011
@@ -183,10 +183,13 @@ myfaces._impl.core._Runtime.extendClass(
* @param theForm the form to which the element has to be set to
* @param doNotChange if set to true no change is performed if the element is found already to be rendered
*/
- _setVSTForm: function(theForm, doNotChange) {
+ _setVSTForm: function(theForm) {
+ theForm = this._Lang.byId(theForm);
+ if(!theForm) return;
+
var viewStateField = (theForm.elements) ? theForm.elements[this.P_VIEWSTATE] : null;//this._Dom.findFormElement(elem, this.P_VIEWSTATE);
- if (viewStateField && !doNotChange) {
+ if (viewStateField) {
this._Dom.setAttribute(viewStateField, "value", this.appliedViewState);
} else if (!viewStateField) {
var element = this._Dom.getDummyPlaceHolder();
@@ -201,15 +204,16 @@ myfaces._impl.core._Runtime.extendClass(
},
_setVSTInnerForms: function(elem) {
+ elem = this._Lang.byId(elem);
var replacedForms = this._Dom.findByTagName(elem, "form", false);
- var applyWithoutChange = this._Lang.hitch(this, function(elem) {
- this._setVSTForm(elem, true);
+ var applyVST = this._Lang.hitch(this, function(elem) {
+ this._setVSTForm(elem);
});
try {
- this._Lang.arrForEach(replacedForms, applyWithoutChange, 0, this);
+ this._Lang.arrForEach(replacedForms, applyVST, 0, this);
} finally {
- applyWithoutChange = false;
+ delete applyVST;
}
},
@@ -325,7 +329,8 @@ myfaces._impl.core._Runtime.extendClass(
return true;
}
- this._setVSTForm(sourceForm);
+ this._updateForms.push(sourceForm.id)
+ //this._setVSTForm(sourceForm);
}
else {
// response may contain several blocks
@@ -372,11 +377,14 @@ myfaces._impl.core._Runtime.extendClass(
_pushOperationResult: function(resultNode) {
var pushSubnode = this._Lang.hitch(this, function(currNode) {
var parentForm = this._Dom.getParent(currNode, "form");
+ //if possible we work over the ids
+ //so that elements later replaced are referenced
+ //at the latest possibility
if (null != parentForm) {
- this._updateForms.push(parentForm);
+ this._updateForms.push(parentForm.id || parentForm);
}
else {
- this._updateElems.push(currNode);
+ this._updateElems.push(currNode.id || currNode);
}
});
var isArr = 'undefined' != typeof resultNode.length && 'undefined' == typeof resultNode.nodeType;
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js Fri Mar 11 21:02:35 2011
@@ -25,8 +25,8 @@
/** @namespace myfaces._impl.xhrCore._AjaxRequest */
myfaces._impl.core._Runtime.extendClass("myfaces._impl.xhrCore._BaseRequest", myfaces._impl.xhrCore._FinalizeableObj, {
- _Dom: myfaces._impl._util._Dom,
- _Lang: myfaces._impl._util._Lang,
+ _Dom: null,
+ _Lang: null,
_RT: myfaces._impl.core._Runtime,
_contentType: "application/x-www-form-urlencoded",
@@ -43,6 +43,7 @@ myfaces._impl.core._Runtime.extendClass(
_timeout: null,
_delay:null,
_queueSize:-1,
+ _xhrQueue: null,
_partialIdsArray : null,
//callbacks for onDone... done issues
@@ -51,6 +52,8 @@ myfaces._impl.core._Runtime.extendClass(
//onException exception thrown by the client
//onWarning warning issued by the client
+ //onException exception thrown by the client
+ //onWarning warning issued by the client
_onDone : null,
_onSuccess: null,
_onError: null,
@@ -79,7 +82,7 @@ myfaces._impl.core._Runtime.extendClass(
_VAL_AJAX: "partial/ajax",
-
+
//abstract methods which have to be implemented
@@ -87,9 +90,26 @@ myfaces._impl.core._Runtime.extendClass(
//by using empty ones
constructor_: function() {
this._callSuper("constructor");
+ this._initDefaultFinalizableFields();
+
this._Lang = myfaces._impl._util._Lang;
this._Dom = myfaces._impl._util._Dom;
- this._initDefaultFinalizableFields();
+
+ //we fixate the scopes just in case
+ this._onException = this._Lang.hitch(this, this._stdErrorHandler);
+ this._onWarn = this._Lang.hitch(this, this._stdErrorHandler);
+ this._onError = this._Lang.hitch(this, this._stdXhrServerError);
+ this._onSuccess = this._Lang.hitch(this, this._stdOnSuccess);
+ this._onDone = this._Lang.hitch(this, this._stdOnDone);
+ this._onTimeout = this._Lang.hitch(this, this._stdOnTimeout);
+
+ //we clear any exceptions being thrown
+ //if(this._xhrQueue) {
+ // if(this._xhrQueue.isEmpty()) {
+ this._Lang.clearExceptionProcessed();
+ // }
+ //}
+
},
/**
@@ -120,9 +140,144 @@ myfaces._impl.core._Runtime.extendClass(
this._ajaxUtil.encodeSubmittableFields(ret, this._xhr, this._context, this._source,
this._sourceForm, this._partialIdsArray);
-
+
return ret;
+ },
+
+ _getImpl: function() {
+ this._Impl = this._Impl || myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
+ return this._Impl;
+ },
+
+ /**
+ * standard on done handler which routes to the
+ * event sending specified by the spec
+ *
+ * @param ajaxRequest request object holding all data
+ */
+ _stdOnDone: function() {
+ this._getImpl().sendEvent(this._xhr, this._context, this._getImpl().COMPLETE);
+ },
+
+ /**
+ * standard spec compliant success handler
+ *
+ * @param request the xhr request object
+ * @param context the context holding all values for further processing
+ */
+ _stdOnSuccess: function() {
+ //_onSuccess
+ var _Impl = this._getImpl();
+
+ try {
+ this._response.processResponse(this._xhr, this._context);
+
+ _Impl.sendEvent(this._xhr, this._context, _Impl.SUCCESS);
+ } finally {
+ if (this.isQueued()) {
+ this._xhrQueue.processQueue();
+ }
+ //ie6 helper cleanup
+ delete this._context.source;
+ }
+ },
+
+
+ /**
+ * now to the error case handlers which by spec should
+ * route to our standard error queue
+ *
+ * @param {BaseRequest} ajaxRequest the ajax request object
+ */
+ _stdXhrServerError: function() {
+ var _Impl = this._getImpl();
+
+ //_onError
+ var errorText;
+ try {
+ var UNKNOWN = this._Lang.getMessage("UNKNOWN");
+ var errorText = this.Lang.getMessage("ERR_REQU_FAILED", null,
+ (this._xhr.status || UNKNOWN),
+ (this._xhr.statusText || UNKNOWN));
+
+ } catch (e) {
+ errorText = this._Lang.getMessage("ERR_REQ_FAILED_UNKNOWN", null);
+ } finally {
+ try {
+ _Impl.sendError(this._xhr, this._context, _Impl.HTTPERROR,
+ _Impl.HTTPERROR, errorText);
+ } finally {
+ if (this._xhrQueue) {
+ this._xhrQueue.processQueue();
+ }
+ //ie6 helper cleanup
+ delete this.getContext().source;
+
+ }
+ }
+ //_onError
+
+ },
+
+ /**
+ * standard timeout handler
+ * the details on how to handle the timeout are
+ * handled by the calling request object
+ */
+ _stdOnTimeout: function(request, context) {
+ var _Impl = this._getImpl();
+ try {
+ //we issue an event not an error here before killing the xhr process
+ _Impl.sendEvent(request, context, _Impl.TIMEOUT_EVENT,
+ _Impl.TIMEOUT_EVENT);
+ //timeout done we process the next in the queue
+ } finally {
+ //We trigger the next one in the queue
+ if (this._xhrQueue) {
+ this._xhrQueue.processQueue();
+ }
+ }
+ //ready state done should be called automatically
+ },
+
+ /**
+ * Client error handlers which also in the long run route into our error queue
+ * but also are able to deliver more meaningful messages
+ * note, in case of an error all subsequent xhr requests are dropped
+ * to get a clean state on things
+ *
+ * @param request the xhr request object
+ * @param context the context holding all values for further processing
+ * @param sourceClass (String) the issuing class for a more meaningful message
+ * @param func the issuing function
+ * @param exception the embedded exception
+ */
+ _stdErrorHandler: function(request, context, sourceClass, func, exception) {
+ try {
+ var _Impl = this._getImpl();
+ _Impl.stdErrorHandler(request, context, sourceClass, func, exception);
+ } finally {
+ if (this._xhrQueue) {
+ this._xhrQueue.cleanup();
+ }
+ }
+ },
+
+ getXhr: function() {
+ return this._xhr;
+ },
+
+ getContext: function() {
+ return this._context;
+ },
+
+ setQueue: function(queue) {
+ this._xhrQueue = queue;
+ },
+
+ isQueued: function() {
+ return this._xhrQueue;
}
-
+
});
\ No newline at end of file
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_IFrameRequest.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_IFrameRequest.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_IFrameRequest.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_IFrameRequest.js Fri Mar 11 21:02:35 2011
@@ -62,7 +62,7 @@ myfaces._impl.core._Runtime.extendClass(
* request
*/
send: function() {
- var _Impl = this._RT.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
+ var _Impl = this._getImpl();
var _RT = myfaces._impl.core._Runtime;
this._frame = this._createTransportFrame();
@@ -114,23 +114,26 @@ myfaces._impl.core._Runtime.extendClass(
request.responseText = this._getFrameText();
request.responseXML = this._getFrameXml();
request.readyState = this._READY_STATE_DONE;
-
+ this._xhr = request;
this._onDone(request, this._context);
if (!this._Lang.isXMLParseError(request.responseXML)) {
request.status = 201;
- this._onSuccess(request, this._context);
+ this._onSuccess();
} else {
request.status = 0;
- this._onError(request, this._context);
+ //we simulate the request for our xhr call
+ this._onError();
+
}
} catch (e) {
//_onError
- this._onException(null, this._context, this.CLS_NAME, "constructor", e);
+ this._onException(request, this._context, this.CLS_NAME, "constructor", e);
} finally {
//this closes any hanging or pending comm channel caused by the iframe
this._clearFrame();
this._frame = null;
+ this._xhr = null;
}
},
@@ -171,7 +174,7 @@ myfaces._impl.core._Runtime.extendClass(
_initAjaxParams: function() {
- var _Impl = myfaces._impl.core.Impl;
+ var _Impl = this._getImpl();
//this._appendHiddenValue(_Impl.P_AJAX, "");
var appendHiddenValue = this._Lang.hitch(this, this._appendHiddenValue);
for (var key in this._passThrough) {
@@ -185,7 +188,7 @@ myfaces._impl.core._Runtime.extendClass(
},
_removeAjaxParams: function(oldTarget) {
- var _Impl = myfaces._impl.core.Impl;
+ var _Impl = this._getImpl();
this._sourceForm.target = oldTarget;
//some browsers optimize this and loose their scope that way,
//I am still not sure why, but probably because the function itself
Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js?rev=1080757&r1=1080756&r2=1080757&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js Fri Mar 11 21:02:35 2011
@@ -61,7 +61,7 @@ myfaces._impl.core._Runtime.extendClass(
*/
_q: new myfaces._impl.xhrCore._AjaxRequestQueue(),
- _threshold: "ERROR",
+
_Lang : myfaces._impl._util._Lang,
_RT: myfaces._impl.core._Runtime,
@@ -78,7 +78,9 @@ myfaces._impl.core._Runtime.extendClass(
* @param {Object} passThrgh (Map) values to be passed through
**/
xhrPost : function(source, sourceForm, context, passThrgh) {
- (new (this._getAjaxReqClass(context))(this._getArguments(source, sourceForm, context, passThrgh))).send();
+ var args = this._getArguments(source, sourceForm, context, passThrgh);
+ delete args.xhrQueue;
+ (new (this._getAjaxReqClass(context))(args)).send();
},
/**
@@ -112,6 +114,7 @@ myfaces._impl.core._Runtime.extendClass(
// since there are no cross browser ways to resolve a timeout on xhr level
// we have to live with it
args.ajaxType = "GET";
+ delete args.xhrQueue;
(new (this._getAjaxReqClass(context))(args)).send();
},
@@ -152,7 +155,7 @@ myfaces._impl.core._Runtime.extendClass(
// note in get the timeout is not working delay however is and queue size as well
// since there are no cross browser ways to resolve a timeout on xhr level
// we have to live with it
-
+ delete args.xhrQueue;
(new (this._getMultipartReqClass(context))(args)).send();
},
@@ -191,6 +194,7 @@ myfaces._impl.core._Runtime.extendClass(
// since there are no cross browser ways to resolve a timeout on xhr level
// we have to live with it
args.ajaxType = "GET";
+ delete args.xhrQueue;
(new (this._getMultipartReqClass(context))(args)).send();
},
@@ -221,7 +225,9 @@ myfaces._impl.core._Runtime.extendClass(
* @param {XmlHttpRequest} context - the ajax context
*/
response : function(request, context) {
- this._q._curReq._response.processResponse(request, context);
+ var ajaxObj = new (this._getAjaxReqClass(context))({xhr: request, context: context});
+
+ ajaxObj._response.processResponse(request, context);
},
/**
@@ -244,25 +250,8 @@ myfaces._impl.core._Runtime.extendClass(
"sourceForm": sourceForm,
"context": context,
"passThrough": passThrgh,
- "xhrQueue": this._q,
-
- //standard done callback
- "onDone": this._Lang.hitch(this, this._stdOnDone),
- //standard success callback
- "onSuccess": this._Lang.hitch(this, this._stdOnSuccess),
- //standard server side error callback
- "onError": this._Lang.hitch(this, this._stdOnError),
-
- //standard timeout callback
- "onTimeout": this._Lang.hitch(this, this._stdOnTimeout),
-
- //now to the internal error handlers which perform operations
- //on the queue
- //standard exception handling callback
- "onException": this._Lang.hitch(this, this._stdErrorHandler),
- //standard warning handling callback
- "onWarn": this._Lang.hitch(this, this._stdErrorHandler)
- };
+ "xhrQueue": this._q
+ };
//we now mix in the config settings which might either be set globally
//or pushed in under the context myfaces.<contextValue> into the current request
@@ -297,136 +286,10 @@ myfaces._impl.core._Runtime.extendClass(
}
},
- /**
- * standard on done handler which routes to the
- * event sending specified by the spec
- *
- * @param request the xhr request object
- * @param context the context holding all values for further processing
- */
- _stdOnDone: function(request, context) {
- this._loadImpl();
- this._Impl.sendEvent(request, context, this._Impl.COMPLETE);
- },
- /**
- * standard spec compliant success handler
- *
- * @param request the xhr request object
- * @param context the context holding all values for further processing
- */
- _stdOnSuccess: function(request, context) {
- //_onSuccess
- this._loadImpl();
- try {
- this._Impl.response(request, context);
-
- this._Impl.sendEvent(request, context, this._Impl.SUCCESS);
- } finally {
- this._q.processQueue();
- //ie6 helper cleanup
- delete context.source;
- }
- },
- /**
- * now to the error case handlers which by spec should
- * route to our standard error queue
- *
- * @param request the xhr request object
- * @param context the context holding all values for further processing
- */
- _stdOnError: function(request, context) {
- this._loadImpl();
-
- //_onError
- var errorText;
- try {
- errorText = "Request failed";
- if (request.status) {
- errorText += "with status " + request.status;
- if (request.statusText) {
- errorText += " and reason " + this._xhr.statusText;
- }
- }
-
- } catch (e) {
- errorText = "Request failed with unknown status";
- } finally {
- try {
- this._Impl.sendError(request, context, this._Impl.HTTPERROR,
- this._Impl.HTTPERROR, errorText);
- } finally {
- this._q.processQueue();
- //ie6 helper cleanup
- delete context.source;
-
- }
- }
- //_onError
-
- },
-
- /**
- * standard timeout handler
- * the details on how to handle the timeout are
- * handled by the calling request object
- */
- _stdOnTimeout: function(request, context) {
- this._loadImpl();
- try {
- //we issue an event not an error here before killing the xhr process
- this._Impl.sendEvent(request, context, this._Impl.TIMEOUT_EVENT,
- this._Impl.TIMEOUT_EVENT);
- //timeout done we process the next in the queue
- } finally {
- //We trigger the next one in the queue
- this._q.processQueue();
- }
- //ready state done should be called automatically
- },
-
- /**
- * Client error handlers which also in the long run route into our error queue
- * but also are able to deliver more meaningful messages
- * note, in case of an error all subsequent xhr requests are dropped
- * to get a clean state on things
- *
- * @param request the xhr request object
- * @param context the context holding all values for further processing
- * @param sourceClass (String) the issuing class for a more meaningful message
- * @param func the issuing function
- * @param exception the embedded exception
- */
- _stdErrorHandler: function(request, context, sourceClass, func, exception) {
- this._loadImpl();
- var _Lang = myfaces._impl._util._Lang;
- var exProcessed = _Lang.isExceptionProcessed(exception);
- try {
- //newer browsers do not allow to hold additional values on native objects like exceptions
- //we hence capsule it into the request, which is gced automatically
- //on ie as well, since the stdErrorHandler usually is called between requests
- //this is a valid approach
-
- if (this._threshold == "ERROR" && !exProcessed) {
- this._Impl.sendError(request, context, this._Impl.CLIENT_ERROR, exception.name,
- "MyFaces ERROR:" + this._Lang.createErrorMsg(sourceClass, func, exception));
- }
- } finally {
- this._q.cleanup();
- //we forward the exception, just in case so that the client
- //will receive it in any way
- try {
- if(!exProcessed) {
- _Lang.setExceptionProcessed(exception);
- }
- } catch(e) {
- }
- throw exception;
- }
- },
_loadImpl: function() {