332 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Deferred Loading
Wed, Apr 24th 2013 156
Rewriting URL in Domino using DSAPI.
Wed, Mar 6th 2013 183
Mongodb - Enable Authentication
Sun, Mar 3rd 2013 111
Fighting for control of URL in Domino
Wed, Feb 27th 2013 93
Nodejs and compression of HTML, JS, CSS
Tue, Feb 5th 2013 169
Node.js first experience and first simple project
Wed, Jan 30th 2013 180
First couple days with IBM Domino Designer 9.0 Social Edition
Mon, Dec 17th 2012 184
Top 10
First couple days with IBM Domino Designer 9.0 Social Edition
Mon, Dec 17th 2012 184
Rewriting URL in Domino using DSAPI.
Wed, Mar 6th 2013 183
Node.js first experience and first simple project
Wed, Jan 30th 2013 180
Nodejs and compression of HTML, JS, CSS
Tue, Feb 5th 2013 169
Exception occurred calling method NotesAgent.runWithDocumentContext(lotus.domino.local.Document) null
Fri, Aug 3rd 2012 162
Deferred Loading
Wed, Apr 24th 2013 156
Moved from Ukraine to Denmark
Sun, Dec 16th 2012 144
Computewithform does not work properly at 8.5.2
Fri, Nov 12th 2010 142
Copy/Paste substitutions freezes my Lotus Notes
Tue, May 31st 2011 141
ViewEntry and Show multiple values as separate entries
Tue, Jul 3rd 2012 131


Error pages in Domino
   

First of all I'd like to briefly describe few another ways we can use to manage error pages in Domino.
Also notice, I will definitely update post few times more after all.

1. Lazy solution $$ReturnGeneralError and MessageString
It's the most fast and easy solutions, it require to create 1 design element (form) $$ReturnGeneralError, style it and add MessageString somewhere to explain what is wrong
Benefits:
- I see only 1 advantage compare to another approaches, its time to implement. Once you create $$ReturnGeneralError it starts to work. So few clicks and few minutes to manage output UI and you have solution.
Disadvantages:
- works inside of application only. So if you have 10 web applications, you need to manage error page in each of it. However you can setup inheritance and manage all error pages from 1 place etc.
- not very flexible on my opinion as we can operate with form-design elements only.

2. HTTP response headers
Simply create error page as design element or as document (does not matter) and create rule for your website in Domino Directory database. It does not require special knowledge and it is simple to use.


Benefits:
- easy to manage
- path to Error page (means we can use different database to keep error pages)
- we can use both: Design Elements and Documents as error page.
Disadvantages:
- require minor Administration of Domino skills.
it works in the same way as client side redirection. i.e. user will see “blink” of standard 404 page before loading custom 404 page.

3. "Whole server" solution
Use HTTPMultiErrorPage property in the Notes.ini file, for example HTTPMultiErrorPage=/error.html. Create rule on the Domino server for /error.html to be substituted corresponding page.
Benefits:
Disadvatages:

4. DSPAI as error handler for Domino
Most complicated approach but also most flexible from my point of view. There is quite low information about how to use it. It requires knowledge of Notes C Api as well. If you want to see how it looks, here is very good exampe (it helped me a lot) on loggin using DSAPI
Company I worked in use DSAPI for handling URL already, and now we are near to implement error handling using DSAPI as well (it already implemented it on development server, so soon I will show you real links etc).
DSAPI allows us to catch responses Domino generated for users and we can replace output in case if responce 400, 404 or any another.

I will post most important part of logic here, just to how overview how DSAPI works and what is gives to us. Notice I've changed code a bit, to show only most important part of it (I will copy comments from Paul's example just to make things faster) 

1. initiation of filter and register for response event
/*---
* FilterInit() - Required filter entry point. Called upon
* filter startup, which occurs when HTTP server task is started.
*/
DLLEXPORT unsigned int FilterInit(FilterInitData* filterInitData) {
   filterInitData->eventFlags = kFilterResponse;
}
so what we did there, say to filter that we want to process response events
2. Link events we registered with functions
 /*---
* HttpFilterProc() - Required filter entry point. Dispatches the event notifications to the appropriate functions for handling the events.
*/
DLLEXPORT DWORD HttpFilterProc(FilterContext *pContext, DWORD dwEventType, void *pEventData)
{
 switch (dwEventType) {
  case kFilterResponse:
   return Response(pContext, pEventData);
 }

 return kFilterNotHandled;
}
Now we can process Responses to users
3. This is how we process Response to users
int Response(FilterContext* context, FilterResponseHeaders* eventData) {
 int responce = eventData->responseCode;

 if (responce==404) {
  if (Send404(context) == TRUE) {
   return kFilterHandledRequest;
  }
 }
 return kFilterNotHandled;
}
4. Finally code for Send404() how we replace content to users
While you read code you need to know that when we load filter we also initiate a table with KEY-HTML arrays. Yes we keep in memory Error HTML pages with keys we need. Our Keys - domain, we handle error pages on domain level, means for domain1.com - is 1 error page, for domain2.com is another error page. But you can do it in another way its up to you.
int Send404(FilterContext* context) {
 FilterResponseHeaders         response;
 unsigned int   errID = 0;
 char     szBuffer[DEFAULT_BUFFER_SIZE]={0};
 char     pszErrorPage[ERRRO_PAGE_SIZE]={0};
 FilterParsedRequestLine pRequestLine;
 unsigned int   pErrID;
 int      i;

 // As we are returning the entire page to the browser, we can 
 // set the response code to 404 (so the domino web log will show the error)
 response.responseCode=404;
 response.reasonText="Bad Request";
 
 // get domain name (its our key), could be done faster? right now its simple walk via 10-20 documents which is fine for now
 context->ServerSupport(context, kGetParsedRequest, &pRequestLine, NULL, NULL, &pErrID);
 for(i=0; i<errorPagesCount;i++) {
  if (strcmp(errorKey[i], pRequestLine.pHostName)==0) {
   strcpy(pszErrorPage, errorHTML[i]);
   i=errorPagesCount;
  }
 }

 if(strlen(pszErrorPage)<10) {
  sprintf(szBuffer, "Error page on %s is very small, something wrong", pRequestLine.pHostName);
  writeToLog(CRITICAL_MSG, szBuffer);
  return FALSE;
 }

 sprintf(szBuffer, "Content-Type: text/html; charset=UTF-8nnContent-length: %inn", strlen(pszErrorPage));
 response.headerText = szBuffer;

 if (context->ServerSupport(context, kWriteResponseHeaders, &response, 0, 0, &errID) != TRUE) {
  sprintf(szBuffer, "Error sending redirect, code: %d", errID);
  writeToLog(CRITICAL_MSG, szBuffer);
  return FALSE;
 }
    if (context->WriteClient(context, pszErrorPage, (unsigned int) strlen(pszErrorPage), 0, &errID) != TRUE) {
  sprintf(szBuffer, "Error sending redirect, code: %d", errID);
  writeToLog(CRITICAL_MSG, szBuffer);
  return FALSE;
 }
 return TRUE;
}
OK guys, I've shared most complicated part of this DSAPI for error handling, rest you have complete yourself (homework :)), but feel free to ask my help here if you need.
benefits:
- most flexible approach (at least from those which I know)
- our logic control everything we want and we clearly see what is going on
disadvantages:
- most complicated ways from all I described
- require knowledge of Notes C API
- I did not try yet this solution with Linux servers (but I know it is possible to do)
- it may crash your Domino server in case if you did you filter wrong (memory leak etc)


5. xPage error handling is on way (on pause actually) and would be nice if somebody help me with that. I've read few articles in past from Per Henrik: XPages custom 404 and error page and Controlling the HTTP response status code in XPages, I think they can be very useful for those who doing in xPages. We will try this approach as we have ongoing huge projects based on xPage. 

Hey:
- ask to update/more details to article
- notify me about issues
- let me know if you know better way to handle errors

strongly recommended as it can help to many developers in future.

---------------------
http://feedproxy.google.com/~r/dpastov/~3/sypIIHW2wac/error-pages-in-domino.html
Jan 24, 2012
101 hits



Recent Blog Posts
156


Deferred Loading
Wed, Apr 24th 2013 10:16a   Dmytro Pastovenskyi
On my job we are trying to decrease time for loading pages as much as it is possible, we simply want 'fast pages'. We don't want our users waited for 2 seconds each time they load page. We are focusing to keep not more then 0.5-1 second per page and we are doing really a lot in that area. Nowadays It's quite common for most of websites to include javascripts just in head area (or at bottom area) as static html so each time we load pages they will be not responsive till all resources will be [read] Keywords: javascript
183


Rewriting URL in Domino using DSAPI.
Wed, Mar 6th 2013 5:12a   Dmytro Pastovenskyi
I will briefly describe what we were aiming to achieve. In order to open page with parameters Domino requires to add ?open or ?opendocument action and only after that Domino allows to add parameters. It's quite annoying for us due to some integration with another systems, those systems expect they can simply add parameters just after our pages, i.e.: http://www.host/page?parameter=123 etc. Also important reason - we simply do not like this ?open or ?opendocument in URL. we want to be able t [read] Keywords: domino integration
111


Mongodb - Enable Authentication
Sun, Mar 3rd 2013 11:11a   Dmytro Pastovenskyi
Basically it is very easy to do, 1. open mongodb shell 2. open admin db and add admin user (you need to have 1 user otherwise you can' lose access to your databases at all) use admin db.addUser("admin","12345") 3. Enable authentication auth=true (simply un-comment it) in config file 'sudo vi /etc/mongodb.conf', save changes and restart mongodb service sudo service mongodb restart For more information please read this Security Practices and Management [read] Keywords: admin administration security
93


Fighting for control of URL in Domino
Wed, Feb 27th 2013 8:09a   Dmytro Pastovenskyi
We have really annoying problem for years with our URLs on all websites based on Domino. We use classic approach because we want control all tags + we like jQuery more etc. Our problem is about mandatory action [?open | ?opendocument] for pages with parameters, so if you want to add parameters to your page (i.e. param1=123) you have to add [?open | ?opendocument] just after your URL and only then you are allowed to add parameters. Not really a huge problem, however we want to use new trackin [read] Keywords: domino google
169


Nodejs and compression of HTML, JS, CSS
Tue, Feb 5th 2013 5:11a   Dmytro Pastovenskyi
.code { background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Verdana, Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%; } To decrease loading time for pages, it is always nice to minify your HTML, CSS and JS. Also to decrease number of requests we inject our minified CSS/JS directly on our pages (ofc we will do that unless our CSS/JS have small size), so minus 2 requests to all pages. [read] Keywords: css
180


Node.js first experience and first simple project
Wed, Jan 30th 2013 7:12a   Dmytro Pastovenskyi
From 2013 I've started to learn (as much as I've free time) Node.js. 'Domino/Notes' still my main, however it is always nice to learn something new. Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. Together with Andrew Kuba (who guide me ho [read] Keywords: domino notes application applications css database javascript network




184


First couple days with IBM Domino Designer 9.0 Social Edition
Mon, Dec 17th 2012 5:15a   Dmytro Pastovenskyi
Worked 2 days already with Domino Designer 9 (I do not really care about changes in Notes 9, as I believe in 'web' direction). I did not find something really new/impressive for developers, however worked only 2 days and also I do not forget that it is just a beta. My impression: It is fast enough, however I do not feel difference compare to my 8.5.3, perhaps my laptop just to good. Ext Library is included by default. I've also read that now we have an API (Java, LS, C API) for C&S, wou [read] Keywords: domino ibm lotus notes xpages application blogger dojo java javascript laptop properties server
144


Moved from Ukraine to Denmark
Sun, Dec 16th 2012 5:15a   Dmytro Pastovenskyi
From 1-st December I work and live in Denmark. It's really interesting experience for me and my family. I had been working with e-conomic from Kiev for more then 3 years and at some point company decided that it had sense to invite me to work in main office. Now I'm here, so wanna tell 'hi' to those who live here :) Couple fresh photos of Copenhagen. City is ready for Christmas: Now most funny thing :), we met hundred well organized girls, they marched along the main shop-street [read] Keywords: blogger office
87


What is comfort zone for Domino developers our days?
Tue, Oct 9th 2012 6:09a   Dmytro Pastovenskyi
Lotus Script is no longer in my 'comfort zone' anymore but Java/JavaScript. That's actually it. We already moved all (well 90%) of backend to Java. Now Lotus Script serves only to provide validation/picklist/msgbox on forms/views for existing 'classic' applications. Now we are slowly moving everything to web and I like that. We are aiming in few years to let our users to un-install LN and simply use browsers and that would be perfect. That time we should have no even 1 line LS and @Formu [read] Keywords: domino lotus applications blogger java javascript
162


Exception occurred calling method NotesAgent.runWithDocumentContext(lotus.domino.local.Document) null
Fri, Aug 3rd 2012 9:10a   Dmytro Pastovenskyi
Tried to run agent with 'context document' in xPage (via SSJS) and got this problem. I did not find a way how to solve that except to enable checkbox 'Run as Web User' for agent, however I need to run agent from 'signer' as 'runner' has Reader access and my agent update should document. It's terrible with this problem (if it is problem ofc :)). What should I do know? [read] Keywords: agent domino lotus blogger




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition