Fórum

How to set session timeout for portlet in Liferay

thumbnail
Subhasis Roy, modificado 11 Anos atrás.

How to set session timeout for portlet in Liferay

Expert Postagens: 275 Data de Entrada: 20/01/12 Postagens Recentes
hi,

I want to set the session timeout in my custom portlet in Liferay. So how can I do that?

If I am not wrong writing the following lines in web.xml will set the session at portal level. Please make me correct if i am wrong.

web.xml entry:
<session-config>
<session-timeout>30</session-timeout>
</session-config>

So just want to know the session timeout at portlet level if possible.
thumbnail
Subhash Pavuskar, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Regular Member Postagens: 234 Data de Entrada: 13/03/12 Postagens Recentes
Hi Subhasis,

If i am not wrong you mean to say session timeout configurable for just one portlet on page?
thumbnail
Subhasis Roy, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Expert Postagens: 275 Data de Entrada: 20/01/12 Postagens Recentes
Subhash Pavuskar:
Hi Subhasis,

If i am not wrong you mean to say session timeout configurable for just one portlet on page?



I have changed the timeout value in the web.xml under "\tomcat\webapps\ROOT\WEB-INF".

<session-config>
<session-timeout>2</session-timeout>
</session-config>

Now its taking the new value and expires after 2minutes as I set and showing the popup before expiring. But i want to know whether I can set the session expire value at portlet level also or not.
thumbnail
Subhasis Roy, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Expert Postagens: 275 Data de Entrada: 20/01/12 Postagens Recentes
Subhash Pavuskar:
Hi Subhasis,

If i am not wrong you mean to say session timeout configurable for just one portlet on page?



Yes you are correct.
I have changed the timeout value in the web.xml under "\tomcat\webapps\ROOT\WEB-INF".

<session-config>
<session-timeout>2</session-timeout>
</session-config>

Now its taking the new value and expires after 2minutes as I set and showing the popup before expiring. But i want to know whether I can set the session expire value at portlet level also or not.
thumbnail
Subhash Pavuskar, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Regular Member Postagens: 234 Data de Entrada: 13/03/12 Postagens Recentes
Hi Subhasis,

I dont think its possible to have session timeout for one portlet and stay active on others !! Sorry if i am wrong !!
Prashant Mirajkar, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

New Member Postagens: 22 Data de Entrada: 24/11/08 Postagens Recentes
Refer to http://www.liferay.com/community/forums/-/message_boards/message/18948429

If your portlet is part of application i.e. other portlets in same war all sessions will have same expiry. You can also have an implementation where you specify per portlet expiry in preferences and set maxInactiveInterval accordingly. However this value has to be lower than those for war or portal.

Prashant
thumbnail
Manish Kumar, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Junior Member Postagens: 93 Data de Entrada: 02/03/12 Postagens Recentes
Hello Subhasis,
You are right with the way you mentioned with web.xml. But there may be some differences if you have another portlet in the same project.
You can also check another way of session timeout by this Liferay Documentation

Thanks,
Manish Kumar.
thumbnail
Subhasis Roy, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Expert Postagens: 275 Data de Entrada: 20/01/12 Postagens Recentes
Manish Kumar:
Hello Subhasis,
You are right with the way you mentioned with web.xml. But there may be some differences if you have another portlet in the same project.
You can also check another way of session timeout by this Liferay Documentation

Thanks,
Manish Kumar.



Hi Manish ,

Thanks. But my concern is "Is it possible to Configure session timeout for a specific portlet in a portal page"
For example, if I have 6 portlets on a page, can I configure one to timeout after 10minutes of inactivity and the other 5 stay active? (Considering that at the portal level I already set the timeout to 30 minutes...and at one portlet only I want to set the session timeout to 10 minutes).
thumbnail
Manish Kumar, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Junior Member Postagens: 93 Data de Entrada: 02/03/12 Postagens Recentes
Hello Subhasis,
I think this is possible as we may have multiple portlets consist of separate sessions, so we can handle this separately and having timeouts independently.
But this is having a drawback that we have to handle the Theme timeout and all the portlet time out to make the synchronization.
You have to handle this case separately.
Hope this will help you.

Thanks,
Manish Kumar
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
You're all wrong and not thinking about the use cases...

A user logs into the portal and the portal says session timeout is 30 minutes.

User is looking at page w/ multiple portlets on it, maybe they use 1 out of 10.

So the first question is, how do you determine a timeout has been reached? One portlet is very busy, your portlet w/ the 5 minute timeout gets no activity, but that doesn't mean the whole portal should time out...

Next question is, what do you expect to happen when the timeout occurs? If you're thinking the user will be logged out or the portlet session (not servlet session) will get destroyed, you're just wrong again. Timeout only affects the servlet sessions, but does not propagate elsewhere (to logout or portlet session) because those are managed by the portal web app, not yours.

Besides, just a session expiration alone does nothing for you, as when the portlet is used again a new session would be created as if nothing happened for the user, just lost information that they'd end up grumbling about.

Long story short, no you cannot have individual portlet timeout values that have any true meaning in the portal.
thumbnail
Manish Kumar, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Junior Member Postagens: 93 Data de Entrada: 02/03/12 Postagens Recentes
Thanks David, you explained that very nicely.
If i am not wrong, I understood portlet session time out is meaningful to make all the information lost for the specific portlet, and the portal timeout is for every portlet.
We should use both timeout according to our requirement. We need to handle them separately.
Thanks,
Manish Kumar
thumbnail
Subhasis Roy, modificado 11 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Expert Postagens: 275 Data de Entrada: 20/01/12 Postagens Recentes
Thanks for a nice explanation david.
Eswaran R, modificado 9 Anos atrás.

RE: How to set session timeout for portlet in Liferay

Junior Member Postagens: 82 Data de Entrada: 29/12/14 Postagens Recentes
hi ..

how to both ( liferay tomcat and portlet page ) session creation for same session timeout ..

kindly help me ...