Monday, June 28, 2010

Introduction to Domino servlets - Part 1

Domino servers support Java servlets.  According to wikipedia, servlets are "a Java class which conforms to the Java Servlet API, a protocol by which a Java class may respond to http requests".

For the Domino developer, it is easiest to think of servlets as Java web agents that sit outside a database.  There are two advantages of using servlets over standard Java web agents:
  1. They are not constrained by the limitations of agents inside a database.  So, for example, a servlet can access the raw HTTP data sent by the browser - whereas this information is already pre-processed in a standard agent and cannot be accessed.  In addition, a servlet can send binary data to a browser - an agent cannot.
  2. They are only loaded into memory the first time they are called.  This means they run more efficiently than standard web agents -  which are loaded into memory every time they run.

In order to use Java servlets, your Domino server needs to enable the Domino Servlet Manager. This is done in the Internet Protocols... section of the server configuration document:


There are a series of configuration options for Java servlets, however, the default options will generally suffice.  You will need to restart the server once the servlet manager has been enabled.

Part 2 of this post will examine how to write a servlet in Java.  The final part will examine how to implement and call them from your Domino server.

Wednesday, June 9, 2010

Domino 8.5 upgrade gotcha

There is a difference in the functionality of the Send method between Domino version 7.0.3 and Domino version 8.5.1.  In Domino 7.0.3, the following code:
Call document.Send(False, "First Person/OU=One/OU=2/O=3; Second Person/OU=Four/OU=Five/O=Six")
would send two e-mails - one to First Person  and another to Second Person.  Domino treated the ";" character as a name separator.

With Domino 8.5.1, this is no longer the case.  Domino no longer recognises the ";" as a name separator.  Instead, it will now attempt to send an e-mail to a person called "First Person/OU=One/OU=2/O=3; Second Person/OU=Four/OU=Five/O=Six" - and will obviously fail.

So, what is the correct code for Domino 8.5?  To achieve the same result as Domino 7.0, your code now needs to be written as follows:
Dim names(1) As String
names(0) = "First Person/OU=One/OU=2/O=3"
names(1) =  "Second Person/OU=Four/OU=Five/O=Six"
Call document.Send(False, names)
The Send method expects an array of strings as the second argument.  The problem is identical, regardless of whether you supply the recipient names as a parameter on the Send method or you add a SendTo field to the document.