Creating a Servlet for IBM Domino

Another tool in your Web Development toolbox…

Over a few posts I’m going to build a Servlet in Java and deploy it on a Domino server and progressively make it do more useful things.

The next few posts will cover:

  • Creating the basic Servlet
  • Tweaking OpenLog from OpenNTF to provide a mechanism for logging
  • Enable the Servlet to use Domino objects via the Extension Library
  • Using the Apache HTTP libraries to access other web resources
  • Create and return some XML.

Along the way we’ll have a quick chat about Thread Safety.

As with so many things in Notes and Domino development there are many ways to get the job done. Servlets being no exception. In addition to this method you could also deploy one as OSGi plugin or create a simpler xAgent.  This is just one way.

I have to acknowledge some help I’ve had along the way including Niklas Heidloff, Nathan Freeman and Sven HasselBach (via his blog which shares a link to a Chinese Developerworks article).  I will also come to thank Paul Withers as it’s his implementation of Openlog that I’ll be gently tweaking so I can use it in the Servlet.

The method described in the following posts runs within the context of a single NSF but is easy to create and manage.  The OSGi method for creating a Servlet ( is a little trickier to create and manage for a more traditional Notes developer audience, I think.

What is a servlet?

A Servlet is a UI-less Java program that extends HttpServlet that can be run on a Web Server.  It’s able to handle requests from browsers or other clients over HTTP and HTTPS protocols.  The Servlet can deal with GET, POST, PUT, DELETE and TRACE requests, reading the data sent with the request and providing a response.

Why would you want one?

You might want to use one if you wanted to have clients send data to your server and have it return custom HTML, XML or other markup based on the submitted information.

How about using a Servlet to receive confimation of an order and payment made via a Credit Card processing service and using various REST Web Services to create software licenses and CRM accounts?

There are many use cases for which Servlets could be useful and a worthwhile addition  to your arsenal.

Why not use an xAgent:

I’m not sure what the answer to that is, although at first glance the xAgent looks a bit like the kind of thing we used to do in Lotuscript. Ultimately I imagine an xAgent is compiled into a JSP Servlet and might perform similarly (8.5.3 onwards). Perhaps if you’re planning to write a lot of java the Servlet might be better. If you have a view chip in.


Domino Designer 8.5.3+ (but apparently not 9 yet, I’ve tried and had problems with Package Explorer)

Domino Server 8.5.3+ (Will probably work with earlier releases but 8.5.3 has been out a while)

An ability to code in Java, and a working knowledge of designer.

Off we go then.

Part 1: Creating a basic servlet

Tagged with: , , ,
Posted in Coding, XPages
One comment on “Creating a Servlet for IBM Domino
  1. Nathan T. Freeman says:

    I’m not sure what I did to help, but whatever it was, thanks for the hat tip. I’m really looking forward to this series. This is undiscovered country for most Domino developers, and it really is empowering to be able to control things at such a fundamental level.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: