Nirvana J2ME : Creating a Session

To interact with a Nirvana Server, the first thing to do is create a Nirvana Session (nObject) object, which is effectively your logical and physical connection to a Nirvana Realm.

Creating a Nirvana Session nObject

There is one method for creating and initialising a Nirvana session in the J2ME API:

  • nObject.createSession(String[] RNAME, String subject

The nObject.createSession method, takes two arguments. The first String[] argument contains a list of RNAME URLs to connect to the server. The second String argument represents a defined user name for this session. The username combined with the host you are connecting from represents your Nirvana subject which is used when configuring access control levels on your Nirvana Realm Server.

The J2ME code snippet below demonstrates the creation of an nSession object and its initialisation:

// Create a session with the specified RNAME array and using j2meUser as the username
nObject mySession= nObject.createSession(RNAME,"j2meUser");
nObject.initSession(mySession); //Initialise this session
Share this page with others:
Tell Your Tweets Facebook It! Add to Delicious Reddit! Digg It! Stumble Upon Add to Your Faves Mixx it
Follow Us:
Keep up with my-Channels on Twitter Become a fan on Facebook LinkedIn Profile Recent Highlights RSS Feed