Brendan Wheble
Brendan Wheble

Reputation: 52

How can I acquire a server session from a Lotus Domino OSGI servlet

From a Domino OSGi Servlet I can acquire a user session using:

ContextInfo.getUserSession()

However, as part of the execution of the servlet I need to access a database to retrieve configuration settings. This database is only accessible to Admins and the server so I need, ideally, a signer or server session as well.

Is this possible?

Upvotes: 2

Views: 394

Answers (2)

Sven Hasselbach
Sven Hasselbach

Reputation: 10485

You can create a server session with NotesFactory.createSession().

The class must be imported by import lotus.domino.NotesFactory;

Upvotes: 2

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15739

There are unsupported methods available in the lotus.domino code that can do this, which are used in org.openntf.domino.session.NativeSession (https://stash.openntf.org/projects/ODA/repos/dominoapi/browse/domino/core/src/main/java/org/openntf/domino/session/NativeSessionFactory.java#14 and https://stash.openntf.org/projects/ODA/repos/dominoapi/browse/domino/core/src/main/java/org/openntf/domino/session/LotusSessionFactory.java#63).

If you want that and more, OpenNTF Domino API Starter Servlet uses ODA to provide a starter OSGi servlet that brings all the benefits of ODA plus examples of JSON handling from IBM packages and an optional HTTP Service. There is an introductory video on NotesIn9.

Upvotes: 1

Related Questions