Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Subhasis Roy
How to set session timeout for portlet in Liferay
18 de Fevereiro de 2013 23:40
Resposta

Subhasis Roy

Ranking: Regular Member

Mensagens: 197

Data de entrada: 19 de Janeiro de 2012

Mensagens 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.
Subhash Pavuskar
RE: How to set session timeout for portlet in Liferay
19 de Fevereiro de 2013 00:43
Resposta

Subhash Pavuskar

Ranking: Regular Member

Mensagens: 216

Data de entrada: 12 de Março de 2012

Mensagens recentes

Hi Subhasis,

If i am not wrong you mean to say session timeout configurable for just one portlet on page?
Prashant Mirajkar
RE: How to set session timeout for portlet in Liferay
19 de Fevereiro de 2013 00:45
Resposta

Prashant Mirajkar

Ranking: New Member

Mensagens: 22

Data de entrada: 23 de Novembro de 2008

Mensagens 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
Subhasis Roy
RE: How to set session timeout for portlet in Liferay
19 de Fevereiro de 2013 01:10
Resposta

Subhasis Roy

Ranking: Regular Member

Mensagens: 197

Data de entrada: 19 de Janeiro de 2012

Mensagens 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.
Subhasis Roy
RE: How to set session timeout for portlet in Liferay
19 de Fevereiro de 2013 01:11
Resposta

Subhasis Roy

Ranking: Regular Member

Mensagens: 197

Data de entrada: 19 de Janeiro de 2012

Mensagens 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.
Manish Kumar
RE: How to set session timeout for portlet in Liferay
19 de Fevereiro de 2013 01:15
Resposta

Manish Kumar

Ranking: Junior Member

Mensagens: 94

Data de entrada: 1 de Março de 2012

Mensagens 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.
Subhash Pavuskar
RE: How to set session timeout for portlet in Liferay
19 de Fevereiro de 2013 01:27
Resposta

Subhash Pavuskar

Ranking: Regular Member

Mensagens: 216

Data de entrada: 12 de Março de 2012

Mensagens 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 !!
Subhasis Roy
RE: How to set session timeout for portlet in Liferay
19 de Fevereiro de 2013 21:27
Resposta

Subhasis Roy

Ranking: Regular Member

Mensagens: 197

Data de entrada: 19 de Janeiro de 2012

Mensagens 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).
Manish Kumar
RE: How to set session timeout for portlet in Liferay
20 de Fevereiro de 2013 02:49
Resposta

Manish Kumar

Ranking: Junior Member

Mensagens: 94

Data de entrada: 1 de Março de 2012

Mensagens 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
David H Nebinger
RE: How to set session timeout for portlet in Liferay
20 de Fevereiro de 2013 05:52
Resposta

David H Nebinger

Ranking: Liferay Legend

Mensagens: 5756

Data de entrada: 1 de Setembro de 2006

Mensagens 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.
Manish Kumar
RE: How to set session timeout for portlet in Liferay
20 de Fevereiro de 2013 06:18
Resposta

Manish Kumar

Ranking: Junior Member

Mensagens: 94

Data de entrada: 1 de Março de 2012

Mensagens 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
Subhasis Roy
RE: How to set session timeout for portlet in Liferay
20 de Fevereiro de 2013 22:08
Resposta

Subhasis Roy

Ranking: Regular Member

Mensagens: 197

Data de entrada: 19 de Janeiro de 2012

Mensagens recentes

Thanks for a nice explanation david.