added a method for setting resource path
[nodejsws.git] / lib / wsrequest.js
index 20e71ba..6f7cb52 100644 (file)
@@ -236,7 +236,12 @@ function resolveAndCall(request, response, caller, purlClass, callback) {
 }
 
 function serveStatic(staticname, response) {
-       var pathName = "./res/"+staticname;
+       var pathName = "";
+       if(typeof global.njspurls.mainResPath != "undefined") {
+               pathName = global.njspurls.mainResPath + "/" + staticname;
+       } else {
+               pathName = "./res/"+staticname;
+       }
        console.log("Pathname for check is ", pathName);
        fs.exists(pathName, function(exists) {
                if(!exists) {