[richfaces-svn-commits] JBoss Rich Faces SVN: r2210 - in trunk: framework/impl/src/main/javascript/ajaxjsf and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Aug 10 20:30:28 EDT 2007


Author: alexsmirnov
Date: 2007-08-10 20:30:28 -0400 (Fri, 10 Aug 2007)
New Revision: 2210

Modified:
   trunk/cdk/maven-archetype-jsfwebapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
   trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
   trunk/samples/richfaces-demo/pom.xml
Log:
Add log trace in page replace function.
Set absolute path for a richfaces-demo sources in webapp

Modified: trunk/cdk/maven-archetype-jsfwebapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/cdk/maven-archetype-jsfwebapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml	2007-08-10 22:31:19 UTC (rev 2209)
+++ trunk/cdk/maven-archetype-jsfwebapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml	2007-08-11 00:30:28 UTC (rev 2210)
@@ -43,6 +43,7 @@
   <dispatcher>REQUEST</dispatcher>
   <dispatcher>FORWARD</dispatcher>
   <dispatcher>INCLUDE</dispatcher>
+  <dispatcher>ERROR</dispatcher>
  </filter-mapping>
  <servlet>
   <servlet-name>Faces Servlet</servlet-name>

Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js	2007-08-10 22:31:19 UTC (rev 2209)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js	2007-08-11 00:30:28 UTC (rev 2210)
@@ -756,12 +756,14 @@
 };
          
 A4J.AJAX.replacePage = function(req){
-		         			var isIE = _SARISSA_IS_IE;
+						LOG.debug("replace all page content with response");
+	         			var isIE = _SARISSA_IS_IE;
 						// maksimkaszynski
 						//Prevent "Permission denied in IE7"
 						//Reset calling principal
 						var oldDocOpen = window.document.open;
 						if (isIE) {
+							LOG.debug("setup custom document.open method");							
 							window.document.open = function() {
 								oldDocOpen.apply(this, arguments);
 							}
@@ -771,32 +773,43 @@
 							var isDocOpen=false;
 							try {  	
 		          				window.document.open(req.getContentType(),true);
+		          				LOG.debug("window.document has opened for writing");
 		          				isDocOpen=true;
 		          				window.document.write(req.getResponseText());
+		          				LOG.debug("window.document has been writed");
 		          				window.document.close();
+		          				LOG.debug("window.document has been closed for writing");
 	          				if(isIE){
 	          			// For Ie , scripts on page not activated.
 	          					window.location.reload(false);
 	          				}
 							} catch(e) {
+		          				LOG.debug("exception during write page content "+e.Message);
 								if(isDocOpen){
 		          					window.document.close();
 								}
 								// Firefox/Mozilla in XHTML case don't support document.write()
 								// Use dom manipulation instead.
-								var	oDomDoc = (new DOMParser()).parseFromString(req.getResponseText(), req.getContentType());
-						    	Sarissa.clearChildNodes(window.document.documentElement);
-								var docNodes = oDomDoc.documentElement.childNodes;
-								for(var i = 0;i<docNodes.length;i++){
+								var	oDomDoc = (new DOMParser()).parseFromString(req.getResponseText(), "text/xml");
+								if(Sarissa.getParseErrorText(oDomDoc) == Sarissa.PARSED_OK){  
+								  LOG.debug("response has parsed as DOM documnet.");
+						    	  Sarissa.clearChildNodes(window.document.documentElement);
+								  var docNodes = oDomDoc.documentElement.childNodes;
+								  for(var i = 0;i<docNodes.length;i++){
 									if(docNodes[i].nodeType == 1){
+				          				LOG.debug("append new node in document");
 							    		var node = window.document.importNode(docNodes[i], true);
 						    			window.document.documentElement.appendChild(node);
 									}
+								 }
+								} else {
+									LOG.error("Error parsing response",Sarissa.getParseErrorText(oDomDoc));
 								}
 								// TODO - scripts reloading ?
 							} finally {
 								window.document.open = oldDocOpen;								
 							}
+	          				LOG.debug("page content has been replaced");
 	          			},30);	
 }
 

Modified: trunk/samples/richfaces-demo/pom.xml
===================================================================
--- trunk/samples/richfaces-demo/pom.xml	2007-08-10 22:31:19 UTC (rev 2209)
+++ trunk/samples/richfaces-demo/pom.xml	2007-08-11 00:30:28 UTC (rev 2210)
@@ -48,7 +48,7 @@
 					<webResources>
 						<resource>
 							<!-- this is relative to the pom.xml directory -->
-							<directory>src/main/java</directory>
+							<directory>${basedir}/src/main/java</directory>
 							<targetPath>WEB-INF/src</targetPath>
 						</resource>
 					</webResources>




More information about the richfaces-svn-commits mailing list