Portlets - Saving a Session from a Server

I am implementing jsr 186 portlets with some servlets in the mix to implement some ajax. The problem is that if I only make AJAX calls for some time, I will lose the session. Oddly enough, saving a servlet session does not prevent the portlet session from timed out.

Is there a way to save a session in my server-side servlets?

FWIW I am using spring and spring mvc / portlet.

Thanks Miguel Ping

+3
source share
2 answers

I implemented it using a javascript timer that continued polling the portlet url. The portlet url was created before it was available in javascript.

0
source

. ( OpenPortal)

, : 1- -, 2- .

ajax . . :

<%
    int per=15000; //ms
    String sessionExtenderPath = "http://portal.abc.com.tr:8080/SessionExtend/SessionExtend";
    //This is a portlet which includes servlet that returns a simple string.
%>

<script>
    periyod=100;

    function invokeRequest(){
     $.get("< %=sessionExtenderPath% >", function(data) {
      alert(1);
     });
    }
    window.setInterval("invokeRequest()",periyod);
</script>

, ( ).

.

+1

Source: https://habr.com/ru/post/1709689/


All Articles