How is http session managed from plug-ins?


Http requests from a servlet in a plug-in can invoke the request.getSession() and get a wrapper for the session:


What is the session object wrapped? Is it related in any way to the user http session in JIRA? Or are plug-ins stateless and are such wraped sessions dummy instances?



2 answers

Hi you can use httpSession in your plugin.

your running with Request object then you can store in the session.

String test=(String)request.getSession().getAttribute("userName");

this way you can try in your servlet make sure you set some value to session.


tousif shaikh.

Just that brings up this related question:

setting attributes just in the way you mentioned is not working.

I've also seen that request.getSession().getId() returns different values across servlet calls, like whether a new session instance is created and wrapped per servlet GET/POST call. :(

On the other hand, I know working with session attributes is a quite common feature used by many plug-ins and it should work, but honestly I debugged the classes provided by the atlassian-plugins-servlet-2.10.1.jar (which is bundled with JIRA 5.1) and they looks like wrapping all the servlet related objects like request, response , session... and my bet is that the session wrapper does not keep a singleton instance to manage the plug-in session, in other words: attributes are lost because they are copied to the "A" session instance and read from the "B" instance and the plug-in framework does not copy the attributes from A to B instance.

Maybe this might be related:

It's not exactly the same case (JIRA session is not closed), but the issue mentioned in this thread happens every time that the plug-in performs a log (Http basinc authentication) in a 3rd party application. Might that cause session lost in plug-in?.

Cleaning the browser cookies resolved the problem!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


251 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you