In my recent J2EE projects their was always a need of consuming JSON and returning JSON. The library we used their was Jackson JSON library.
It was a refreshing way to work with JSON without building or consuming it line by line. Jackson is mapping JSON directly to POJO. So with one line of code the JSON is transformed to a real Java Object and can be used all over your project.
The other way around it also very easy, write your POJO directly to the output writer, like a File or mostly the response of a servlet, which we used in our projects.
Where message is a POJO, and data is JSON as String
Inside a NSF
I was thinking to make it available to a XAgent. First I included the 3 libraries the lib directory under WEB-CONTENT inside my NSF and add them to the build path.
Immediately I a was able to use the code in my Java class. So it worked, but…. if I want to use it in another NSF I need to perform the above steps.
There started the idea to put everything in an OSGi plugin, so all the NSF’s on the Domino server can benefit from it.
I put everything in a plugin project, thanks to the great blog of John Dalsgaard,
Created a feature and update site and put everything on a Bitbucket repository, so everyone can use it.
To get everything working you need to add a custom java policy file in side the <domino directory>jvm/lib/security. You can use the java.pol file who is inside the repository. The benefit of using java.pol is that after an upgrade or what ever, the java.pol file is not affected.
Have fun with it…