X-Git-Url: http://git.pjr.cc/?a=blobdiff_plain;f=lib%2Fwsrequest.js;h=17547e73e165b884d03d79faf68893ca165e6364;hb=6127f038fce5dbe47be01fdc565c14b5d8d24b80;hp=6f7cb52bc27630b3238610d7b80db76fa341049b;hpb=d621aec05d8d430c199dfb72a547ae16dc8b59d4;p=nodejsws.git diff --git a/lib/wsrequest.js b/lib/wsrequest.js index 6f7cb52..17547e7 100644 --- a/lib/wsrequest.js +++ b/lib/wsrequest.js @@ -137,8 +137,11 @@ function urlServicer(request, response, purl) { } } } else { - // handle the purls - var newPurlPath = mainPath+"/"+path.basename(purl.pathname.replace(/\/$/, ""))+".js"; + // handle the purls... we taje the pathname, drop the beginning "/", then drop every after the next "/" + // so we end up with a purl of "abcd" from a url: + // http://host/abcd/qewr/asdf/asdf/asdf/asdf/asdf/ + // and will load mainPath/abcd.js + var newPurlPath = mainPath+"/"+path.basename(purl.pathname.replace(/^\//, "").replace(/\/.*$/, ""))+".js"; console.log("attempting to require: ", newPurlPath); try { var newPurlClass = require(newPurlPath); @@ -153,10 +156,10 @@ function urlServicer(request, response, purl) { if(typeof purlClass.layout == "undefined") { console.log("set via undefined"); - purlLayout = layouts.standard(); + purlLayout = layouts.standard(request, response); } else { // find and resolve the layout - purlLayout = purlClass.layout(); + purlLayout = purlClass.layout(request, response); } // now we should have a layout and a class