Pretty URLs
Mar 21, 2011, 8:09 PM
Way back when I wrote my own blog back-end, I went out of my way to make decent-looking URLs that didn't betray the use of PHP for the code. It's not that using PHP was inherently bad, but the ".php" in the URLs was ugly and would have made it tough to move to any other back-ends. It's just one of those good-idea cleanliness things. Back then, I did it with Apache MultiViews and just had names like "archive.php", so I could make URLs like "/archive/2002/12" for that month's posts.
Since I've started using Domino, however, it's gotten a bit tougher. The parts of the URL within a Notes database can actually be pretty great - something like "/People/Foo+Fooson" is about as good as you'd want. However, it's the database path that kills me. You can set up URL substitution rules, but that's a weird combination of setting up a Directory Web Rule plus making sure that every place you make a URL in your code uses that name. For something like a view column, that'd mean either hard-coding your server-specific setting or sucking it up and using @WebDbName. For the most part, I've given up and gone with the latter, for the sake of portability.
XPages bring good news and bad news.
The good news: your application almost never needs to care about the database file path, ".nsf" extensions, or anything of the like. There may be edge cases where you do, but for the most part you can just start your URLs with "/" and the database path is filled in for you (at the cost of starting non-DB paths with "/.ibmxspres/domino").
The bad news: even though the database path reference is now handled by the runtime and not the programmer's code, I don't know of a way to override the behavior. I'm sure it's there SOMEWHERE, buried in the hordes of Java classes and method calls spawned for each page request, but I don't see it. What I'd really want is to tell the XPages runtime that, while "/wow/forums.nsf" is the "right" way to reference the database, I'd rather it just start with something like "/forums". It seems like something that must be handled in the xsp.properties file, but I haven't found anything about it yet. Admittedly, it's tough to search for - most pages with the keywords I want are talking about @WebDbName replacements in SSJS and how to references external Domino resources. If it's not present already, maybe it's something they'll add in a future point release. One can hope.
Nathan - Dec 2, 2011, 7:43 AM
Hi,
I really want to know the same thing. I develop in an environment where I have dbs for different clients all on the same server and in different folders, so I want to be able to tell the xpages that I want to use "site.com/" as the root and not "/folder/file.nsf/".
I've tried using url substitution but there is conflict/mixup when xpages tries to load the dojo files or uses XSP object to load a page (XSP open page event opens a page by going to "/folder/file.nsf/page.xsp"). So it seems to me that if you wanted to you could use url substitution, but you'd sacrifice the RAD aspects by having to code by hand the correct links.
And yes, I think, because XSP opens pages with filename urls, that the setting would probably reside in the app somewhere rather than the server.