Terrel Shumway wrote: > On Thu, 2002-04-18 at 15:18, Geoffrey Talvola wrote: > > I cleaned up some methods of HTTPRequest that I've been > using internally for > > quite a while and checked them into Webware CVS. Chuck, if > this looks like > > deja-vu it's probably because I saw these methods first in > some of your code > > :-) > > > > originalURLPath() - Returns the URL path of the original > servlet before any > > > > siteRoot() - Returns the URL path components necessary to > get back home from > > > > siteRootFromCurrentServlet() - Similar to siteRoot() but > instead, it returns > > > > servletPathFromSiteRoot() - Returns the "servlet path" of > this servlet > > Are any of these mod_rewrite aware? I know that adapterName() is not. > > Someone mentioned a hack to use an extra environment variable to pass > the pre-mangled REQUESTURI. It would be nice to at least make this a > "standard" hack by making all of these methods aware of the special > ORIGINAL_URI variable. (The use of WK_ABSOLUTE by ModPythonAdapter is > precedent of similar usage.) > > Of course this assumes that your use of these methods is to generate > links to other pages in the app. (I can't think of any other use for > them from the top of my head, but I could be missing something.)
There are 3 purposes to these methods that I know of -- one is to generate links to other pages in the same app (use siteRoot() for that), another is to generate paths to pass into methods like self.forward() and its cousins (use siteRootFromCurrentServlet() for that), and a third is to generate a relative path from site root that you can save in a database as a form of "bookmarking" provided by your application (use servletPathFromSiteRoot() for that). They are especially useful for use in base classes like SitePage where you don't know what depth in the directory tree the servlet is, and you don't know if that servlet may have been forwarded from a different servlet at a different depth. These methods are supposed to do the right thing in those cases. I haven't tested these methods (or any other HTTPRequest methods for that matter) for compatibility with mod_rewrite. I think someone else is going to have to take on the task of mod_rewrite-proofing HTTPRequest. It's definitely a worthy goal, I just don't see myself doing it unless I start using mod_rewrite in my own application. - Geoff _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
