Well, I would want to keep the apps isolated as much as possible, so I
would do something like this...

(1) When App A opens App B, at the same time, it calls a function of its
own that sets a flag in session to indicate that App B is open.

(2) On every page of App A I would have a Javascript function that is
called as a result of a timer started onLoad.  This function would be
something like:

function keepAlive() {
  try {
    if (window.XMLHttpRequest){
      ajaxXHR = new XMLHttpRequest();
    } else {
      ajaxXHR = new ActiveXObject('Microsoft.XMLHTTP');
    }
    ajaxXHR.open("get", "myKeepAliveAction.do", true);
    ajaxXHR.send(null);
  } catch(e) {
    alert(e.message);
  }
}

(3) myKeepAliveAction would do basically nothing, just return null for the
forward.

(4) Be sure to only set the timer onLoad when the flag is set in session
indicating app B is open.

So, what this will do is that when App B is opened, App A would fire this
AJAX request to myKeepAliveAction (be sure to set the timer interval to
something less than App A's timeout period!).  That should keep App A from
timing out and you won't have to worry about refreshing any page or
anything.

The only problem I see is what do you do when App B closes?  I presume
you'd want the timeout in App A to take effect again, but I don't see a
foolproof way to do that.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, May 13, 2005 1:47 am, Patrick Lacson said:
> hi Frank,
>
> you're the second person who suggested making an ajax call.. partly
> because its probably a cleaner approach.
>
> do you have an example of how i can use ajax from webapp B to call
> webapp A in some interval period?
>
> thanks much.
>
>
> On 5/12/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
>> If you can use Javascript (and can require it), what you could do is set
>> a timer in app B's onLoad event to call a Javascript function in app A
>> from app B (parent.myFunction();)... This function could refresh
>> whatever the current page is in some interval less than your timeout
>> period.  You'll have to ensure all pages of app A have that refresh
>> function in page-scope, and that all pages in B set that timer and make
>> the call.
>>
>> If a full-page refresh isn't feasible, you can make an AJAX call to app
>> A that does really nothing, but that should be enough to keep the
>> session from timing out.
>>
>> Does that all make sense? (I'm not sure I described it well)
>>
>> Frank W. Zammetti
>>
>> -----Original Message-----
>>     From: "Patrick Lacson"<[EMAIL PROTECTED]>
>>     Sent: 5/13/05 12:56:43 AM
>>     To: "Tomcat Users List"<tomcat-user@jakarta.apache.org>
>>     Subject: Re: Sessions and keep-alives
>>       I've considered iframes, but unfortunately not an option for us.
>>
>>     >From what I understand AJAX can make async calls to the HTTP server
>>     from the webapplication only, not on behalf of another.  So if the
>>     popup application is webapp B, and the parent webapp A, how can I
>> call
>>     the webapp A server from webapp B for the keep-alive?
>>
>>     On 5/12/05, Tim Funk <[EMAIL PROTECTED]> wrote:
>>     > The simplest kludge is an iframe that is "hidden" and uses a META
>> refresh.
>>     >
>>     > Or look at using ajax.
>>     >
>>     > -Tim
>>     >
>>     > Patrick Lacson wrote:
>>     >
>>     > > hi All!
>>     > >
>>     > > I'm involved in a project that integrates two disparate web
>>     > > applications: webapp A is using WebSphere and webapp B is using
>>     > > Tomcat.
>>     > >
>>     > > The integration involves Single Sign On, with webapp A being the
>>     > > primary webapp from which webapp B is launched.  webapp B is
>> launched
>>     > > as a popup-window.
>>     > >
>>     > > My question is: how can i ensure that while the user is working
>> on the
>>     > > webapp B popup, the parent window webapp A, does not time-out?
>>     > >
>>     > > Thanks in advance!
>>     >
>>     > ---------------------------------------------------------------------
>>     > To unsubscribe, e-mail: [EMAIL PROTECTED]
>>     > For additional commands, e-mail:
>> [EMAIL PROTECTED]
>>     >
>>     >
>>
>>     --
>>     Patrick
>>
>>     ---------------------------------------------------------------------
>>     To unsubscribe, e-mail: [EMAIL PROTECTED]
>>     For additional commands, e-mail: [EMAIL PROTECTED]
>>
>> [Message truncated. Tap Edit->Mark for Download to get remaining
>> portion.]
>>
>>
>
>
> --
> Patrick
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to