You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/11/18 00:04:53 UTC

svn commit: r476380 - /incubator/xap/trunk/src/xap/requestservice/RequestService.js

Author: mturyn
Date: Fri Nov 17 16:04:53 2006
New Revision: 476380

URL: http://svn.apache.org/viewvc?view=rev&rev=476380
Log:
Added an exception to synchronous retrieval when the requested URI produces a 404 (page not available).

Modified:
    incubator/xap/trunk/src/xap/requestservice/RequestService.js

Modified: incubator/xap/trunk/src/xap/requestservice/RequestService.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/requestservice/RequestService.js?view=diff&rev=476380&r1=476379&r2=476380
==============================================================================
--- incubator/xap/trunk/src/xap/requestservice/RequestService.js (original)
+++ incubator/xap/trunk/src/xap/requestservice/RequestService.js Fri Nov 17 16:04:53 2006
@@ -19,6 +19,7 @@
 
 Xap.require("xap.xml.ParserFactory") ;
 Xap.require("xap.util.HttpUtils");
+Xap.require("xap.util.Exception");
 
 /**
  * @class
@@ -123,7 +124,18 @@
  * <code>getCause()</code> method to find out details.
  */
 xap.requestservice.RequestService.prototype.retrieve = function(url) {
-  return xap.util.HttpUtils.get(url); 
+  var content = xap.util.HttpUtils.get(url); 
+  // Requests to tomcat (at least, and at least by default) never "fail",
+  // as such; rather they hand you a 404 page.  This isn't
+  // useful for us, so throw an exception if it's the case:
+  if(content.status == xap.util.HttpUtils.URI_NA){
+  	throw new xap.util.Exception("The requested page"
+  		+ "\n\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240"
+  		+ url
+  		+ "\nis not available."
+  									) ;
+  }
+  return content ;  
 }