Foren

Extend Portal session

Anamica Liferay, geändert vor 1 Jahr.

Extend Portal session

Junior Member Beiträge: 39 Beitrittsdatum: 07.10.09 Neueste Beiträge
Hi

We have Flex portlets in liferay. These flex portlets communicate with DB n stuff...

My issue is this..

Even if we keep working in the portlet the session expires. I get the message saying the session is about the expire in sometime and session expires.. emoticon

So we tried to call a servlet to get the logged-in user id to make sure we access liferays session.. Still no change..emoticon

I need to keep liferay session active while working in my flex portlet.. Since the user is active in the screen.. There it makes no sense expiring session.. right???emoticon

Can nebody help me?

Thanks in advance.
Lilford
thumbnail
Shagul Khajamohideen, geändert vor 13 Jahren.

RE: Extend Portal session

Liferay Master Beiträge: 758 Beitrittsdatum: 27.09.07 Neueste Beiträge
Anamica Liferay, geändert vor 1 Jahr.

RE: Extend Portal session

Junior Member Beiträge: 39 Beitrittsdatum: 07.10.09 Neueste Beiträge
Shagul Khajamohideen:
The below post may help.
http://www.liferay.com/community/forums/-/message_boards/message/4595380


The above URL was very helpful... Thanks a bunch.. Here is the code I used in JSP to extend the session..


function extendSession(){
try { if ('noWarning' == mySessionRenewAtWarning()) { mySessionRenew(); } } catch(e) {} 
}

//Closes the warning by invoking the click event of extend button...

function mySessionRenewAtWarning(){
    var jqryWarn = new jQuery;
    var warnElm = jqryWarn.find('.popup-alert-notice');
    if (warnElm.length > 0) {
        // Match content of warning with session expiration warning language
        if (Liferay.Language.get('warning-your-session-will-expire').indexOf(warnElm[0].firstChild.nodeValue) == 0) {
            // click the extend button
            warnElm.find('.popup-alert-close').click();
            return true;
        }
    }
    return "noWarning";
}

// Extends the session and resets the client timer
function mySessionRenew() {
    if (Liferay.Session._stateCheck) {
        window.clearTimeout(Liferay.Session._stateCheck);
        Liferay.Session._stateCheck = null;
    }
    Liferay.Session.extend();
}


However I have another issue now.. I get an alert without any message.. I just have a close and the red alert icon.. Clicking on close does nothing.. The alert keeps coming..
This appears only in one screen!!!!emoticon
Anamica Liferay, geändert vor 1 Jahr.

RE: Extend Portal session

Junior Member Beiträge: 39 Beitrittsdatum: 07.10.09 Neueste Beiträge
Got that working too guys..

Had to set autoExtend true

Liferay.Session.autoExtent = true;

before calling

Liferay.Session.extend();

Thanks again for the help.. emoticon
Azhar md, geändert vor 9 Jahren.

RE: Extend Portal session

Junior Member Beiträge: 59 Beitrittsdatum: 01.12.14 Neueste Beiträge
Hi Lilford Immanuel Arthur,

Got that working too guys..

Had to set autoExtend true

Liferay.Session.autoExtent = true;

before calling

Liferay.Session.extend();

Thanks again for the help..


How u got working kindly help
thumbnail
David H Nebinger, geändert vor 9 Jahren.

RE: Extend Portal session

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
Seriously? You see the dates on this thread are 5 years old?

Cross posting to all threads related to liferay session extension is not going to answer your question any sooner...
Annushree Satpathy, geändert vor 8 Jahren.

RE: Extend Portal session

New Member Beitrag: 1 Beitrittsdatum: 19.01.16 Neueste Beiträge
Hi David,

I read your post on another thread on liferay session expiry
https://www.liferay.com/community/forums/-/message_boards/message/47381705

I have used the Liferay.Session.extend() in the script for the session extension. My question is after adding this, even after 30 mins of idle time, no session expiry message displayed in the portlet. Is this the right behaviour?
Nisarg Parikh, geändert vor 12 Jahren.

RE: Extend Portal session

Expert Beiträge: 262 Beitrittsdatum: 31.12.09 Neueste Beiträge
Hey,

I am facing the same problem, but I am not sure where to write that code.

I have one java script file in which I have written the code to extend the Liferay Session but in which Flex file I have to write a code to call that java script function?

Can you please give me file structure and in which Flex file I have to write? Is there any event interceptor or any other mechanism?

Thank you in advance.

-Nisarg
Paul Butenko, geändert vor 11 Jahren.

RE: Extend Portal session

Junior Member Beiträge: 38 Beitrittsdatum: 02.07.10 Neueste Beiträge
Hello
I have similar problem but for AJAX portlet, here I described how I solved it.
Maybe it can guide you in right direction.

BR,
Paul Butenko
thumbnail
Olaf Kock, geändert vor 11 Jahren.

RE: Extend Portal session

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
for portal-ext.properties:
    #
    # Set the auto-extend mode to true to avoid having to ask the user whether
    # to extend the session or not. Instead it will be automatically extended.
    # The purpose of this mode is to keep the session open as long as the user
    # browser is open and with a portal page loaded. It is recommended to use
    # this setting along with a smaller "session.timeout", such as 5 minutes for
    # better performance.
    #
    session.timeout.auto.extend=false
thumbnail
Hitoshi Ozawa, geändert vor 11 Jahren.

RE: Extend Portal session

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Solutions probably differ from the previous thread because this is an old thread. Another reason not to replies to old threads because solutions may changes between versions. emoticon
thumbnail
Olaf Kock, geändert vor 11 Jahren.

RE: Extend Portal session

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
correct in general. However, this option is old, probably also applies to the first problem (I just browsed through that quickly). All in all the questions sounded very similar and I don't want someone to modify code if there's a simple solution like this.
thumbnail
Hitoshi Ozawa, geändert vor 11 Jahren.

RE: Extend Portal session

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Sorry, my comment was more directed to Paul. I thought you were just replying to his post.