Tuesday, April 18, 2006

use domino servlets unpacked

As many others like you Domino devs out there, I am also approaching Java. For the moment, Java under Domino. And I am also playing more and more with servlets, due to their feature of being loaded into memory. I think this makes things a little faster.

I used to like packing files (classes) into *.jar files, then deploy them on the domino server using ftp, issue 'tell http restart' and test. No more this approach, at least the jar packing. Why ? Because if you deploy a new servlet into domino\servlet\someServlet.jar, you also have to specify the same relative path into the server document (the Classpath field). If you have many servlets, you may end up deal with the 32k limit for the Classpath field.

Solution is to leave the Classpath field to its default domino\servlet path, then recreate the folder hierarchy on the domino server

Example: using Eclipse, I like to keep things organized. I use packages, thus the servlet code is looking something like:

package ro.radu.mypackage ;
public class MyServlet extends HttpServlet {
....
}

When compiled, on the Domino server, I go and create the proper folder hierarchy: domino\servlet\ro\radu\mypackage and copy the MyServlet.class into the last folder.

This is old news, I know :)

The advantage is that you can have one Eclipse project called DominoServlets, and all little servlets can be developed under the same Eclipse package, deployment meaning:
- copy your class file on the Domino server proper path
- if new, modify the servlet.properties file under /domino/data to add an alias or whatever needed.

No comments: