Bonita Engine API : how to know if session is active

1
0
-1

Hello,

I have a Java application that uses the Bonita Engine API to connect to the Bonita server.

I use the following code to connect my user, and it works fine :

LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();
APISession session = loginAPI.login(username, password); 

But once i have logged in my user, I dont't see any way to see if the user session is still active, and if I need to re-log my user.

So my question : how can you see in the Bonita Engine API if the user's session is still active?

1 answer

1
0
-1
This one is the BEST answer!

There is no server side service to check if a session is still valid.

What you can do on client side is to use Session getCreationDate and getDuration methods to calculate the expiration date and compare it to current time. That would not prevent error if all sessions expired due to actions on server side.

If you want to make sure that a session is still valid on server side you can do any kind of read call to the API and catch the InvalidSessionException.

Comments

Submitted by julien.houeix on Wed, 08/23/2017 - 17:22

Thanks for your answer.

What we actually do is that everytime we call the Bonita API, we first log in the user (even if he was already logged in). This way, we are sure to have a valid session.

Notifications