we want to be able to that:
www.host/page?opendocument¶meter=123 ==> www.host/page?parameter=123
I got couple helpful comments in my previous article about URL control in Domino, that helped me to look on different solutions, thanks guys. However I decided that those solutions a bit complicated to setup and they could do some impact on page load time.
I've been working on DSAPI solution last days and finally with some help I've made it! Now we have full control with our URLs, at least I've such feeling :). Let me share my small success to all of you.
Here you can find main steps you need to do. Please keep in mind, I've updated my code a bit as our logic has many rules when exactly to add parameters.
1. Enable flag to catch Rewrite URL event.
filterInitData->eventFlags = kFilterRewriteURL;
2. Link 'rewrite URL' event with you function. DLLEXPORT unsigned int HttpFilterProc(FilterContext* context, unsigned int eventType, void* eventData) {
switch (eventType) {
case kFilterRewriteURL:
return RewriteURL(context, (FilterMapURL *) eventData);
default:
return kFilterNotHandled;
}
}
3. Finally the main logic, that makes URL rewriting. int RewriteURL(FilterContext* context, FilterMapURL* pEventData) {
FilterParsedRequestLine pReqData;
unsigned int errid=0;
// if there are no parameters in URL - nothing to do.
if (strstr(pEventData->url, "?")==NULL) return kFilterNotHandled;
// read request as we are going to update query.
context->ServerSupport(context, kGetParsedRequest, &pReqData, NULL, NULL, &errid);
// if query starts from opendocument - nothing to do
if (strncmp(pReqData.pQueryUri, "opendocument", strlen("opendocument"))==0) return kFilterNotHandled;
// adding opendocument before query and put result in pEventData->pathBuffer
sprintf(pEventData->pathBuffer, "%s?opendocument&%s", pReqData.pPathUri, pReqData.pQueryUri);
return kFilterHandledEvent;
}
Solution we did works like a charm and what is very important it does not affect page load time (we measured of course)Related topics
DSAPI for Domino
Solution for Lotus Domino to the trailing slash problem
Replacement for DSAPI in Java/XPages