Friday, July 12, 2013

Replacement for DSAPI in Java/XPages

I've written few articles about how DSAPI could help you to control classic web application built on Domino. That solution worked perfect for us and difficulties I encountered were:
  • slower development process due to my skill in C;
  • poor documentations about how things work in DSAPI (probably most weak side for me);
  • deployment process (you need to create new DLL each time and upload it to Domno Server, then restart HTTP);
  • you have to be 'very-very' careful with everything, one mistake (i.e. memory leak somewhere) can crash the server at some point;

Last months we worked on new Web CMS based on Java/Velocity in Domino and result I must say was really great. I will make post about most interesting things later: the topic will be about java, html/templates, velocity, git, jenkins, jira and how it works together. I would call it pure Java approach to do development in Domino. The beauty using java as engine allow us to get rid of DSAPI. So everything what have been done with DSAPI (and in total I spend maybe 2-3 weeks) we replaced in 2-3 hours with Java.

case #1: Re-write URL from http://domain/page/subpage/ to http://domain/page/subpage with 301 status. We simply set new location in header and new status
  getResponse().setHeader(LOCATION_HEADER, uri);
case #2: 404/500 etc error pages we only set correct status for response + throw out required content

So my feeling about DSAPI is actually quite good, however be sure you know how to cook it, otherwise - don't go with that solution. Remember my example: I've spent weeks doing DSAPI via C and now we did exactly same in few hours. That feeling when I compared what I spent with DSAPI (via C) compare to new solution with Java. 100 hours agains 3.

Related topics
DSAPI for Domino
Rewriting URL in Domino using DSAPI
Solution for Lotus Domino to the trailing slash problem


Nathan Freeman said...

Dmytro, I think I understand what you wrote to the response stream here, but I don't understand what Java context you were in to do it. Could you provide a little more detail?

I encountered several things recently in my Domino research that lead me to think a more general Java replacement for DSAPI is possible, including for authentication.

Dmytro Pastovenskyi said...

I'm gonna actually to describe much more details about how we organize process in my team. I believe it would be interesting for Domino world. So more details will come soon. And you are right, its possible to replace DSAPI completely with Java.

René Winkelmeyer said...

Hi Dmytro,

thanks for the post. I'm looking forward to your solution as I've done some research in this area in the past too. I want to get rid of per-app/per plug-in used Servlet filters or standard HttpServletResponse methods.

In general I'm thinking of a full replacement/alternative for the DSAPI which serves all three Domino HTTP stacks (native, Equinox, XPD). Is that what you've done?

Best regards, René

Mark Demicoli said...

Good work in this direction. Re-writing URLs is something I really need to do right now. I have a website which utilises 'subdomain' for user accounts.


..where the subdomain is actually the key to a document in a view.

Currently I do the translation using frontend javascript redirection which is horrible.

Dmytro Pastovenskyi said...

I agree, redirect via JS is a bit weird solution:
- users will see blinks;
- it's simply more correct to do this via redirect.

However it is more easy solution and I understand you pain.

admin color commands ark said...

Simple, Clean, Great - as Always! :)
The question is: how do you manage to handle RT-fields and Attachments in RT?

not sore after workout said...

our content is absolutely excellent. I very much appreciate your videos and am learning a lot from them. I just wanted to give you some tips, as a web developer myself, but someone who spent 5 years as a teacher. Your videos are very well structured, however I feel that you, at some points, are speaking too fast. I'm not sure what audience you are going for, but if you would like to include absolute or near total beginners, you'll want to have a lot more pauses, more titles and subtitles, slower speech, and more explanation of basic, albeit technical, terminology. By the time someone watches this video, you might assume someone wanting to learn about RESTful API's might know what a simple GET request is, but that is not necessarily so. In any case, thank you so much for your wonderful videos jam packed with excellent content!