From: Fraser H. <fra...@gm...> - 2009-10-09 11:50:46
|
One way to get the namespace / location into the uri part is simply to put it in as a parameter. I designed the parser so that it considers anything between brackets as a single token. That way I can put urls and uris in as parameters. Another way would be simply to construct the uri based on the parameters. For example all of your custom modules may be in a modules directory and have the same name as the module name. So with the module name in the uri you can construct db/modules/moduleName" at "/db/modules/moduleName.xqm". I also have a function that acts as a fallback system which checks a sequence of directories until it finds the desired file: declare function url:path($input,$quote,$type) { let $t := if($type eq 'full') then $url:fullPathPrefix else() let $q := if($quote eq 'no') then () else if($quote eq 'single') then string("'") else('"') let $path := if(util:binary-doc-available(concat('/db/cms2/sites/', $url:hostName, '/', $input)) or doc(concat('/db/cms2/sites/', $url:hostName, '/', $input))) then (concat('/db/cms2/sites/', $url:hostName, '/', $input)) else if(util:binary-doc-available(concat('/db/cms2/sites/all/', $input)) or doc(concat('/db/cms2/sites/all/', $input))) then (concat('/db/cms2/sites/all/', $input)) else (concat('/db/cms2/', $input)) return concat($q, $t, $path, $q) }; This could be used to find the path if you store your module files in different directories. For example core modules in the applicationRoot / modules and site-specific modules in applicationRoot / sites / mySite / modules. Cheers, Fraser On Fri, Oct 9, 2009 at 1:00 PM, Evgeny Gazdovsky <gaz...@gm...>wrote: > > by the way - using # in URL is not good - user-agent behavior > > unpredictable in this case > Why? > It is only concept. > > > > The parameters are "ordered" parameters based upon the function being > referenced and are part of the url path info: > > index.xq / siteaccess / module / function / parameters > > or > > index.xq / website / content / getImage / 5 / resource1.xml / 200 / 200 > > Have you idea how automate mapping of module's namespace/location into uri > part? > Main idea is decrease a manual labor. > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open > |