Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [rap-dev] RAP & Multitab

Hi

1) Note that it is important to use special urls to open you application,
for example, if you want to look at the tea-example from
org.eclipse.rap.demo, you should use multitab browser (ff, ie7, ie8, etc)
and special urls like: http://127.0.0.1:10080/tea?instanceId=1,
http://127.0.0.1:10080/tea?instanceId=2.

2) When I wrote "I used a "org.eclipse.equinox.http.registry.resources" I
tried to say that I uset an org.eclipse.equinox.http.registry.resources
extention point to register additional pages.

Regards,
Igor

-----Original Message-----
From: rap-dev-bounces@xxxxxxxxxxx [mailto:rap-dev-bounces@xxxxxxxxxxx] On
Behalf Of mail.apptech.nichost.ru
Sent: Sunday, May 10, 2009 8:26 PM
To: 'RAP project development-related communication'
Subject: [rap-dev] RAP & Multitab

Hi

I want to describe the way that you can use to deal with multitab browsers
(or several frames on the html page with the same RAP application from one
server inside).

The way that I use is a wrapping the request and session objects. This
approach based on using special attribute (instanceId) that I we can pass
with http request object or with "referer" header.

I attached patch with, you can use it to see all my changes.

First of all - there are three main classes in the
org.eclipse.rwt.internal.service.wrapper package: RequestWrapper,
SessionWrapper and SessionManager.

1) About RequestWrapper:

It used to wrap request object in special object. There are several members
that overrides the default implementation: getParameter(String name),
getSession() and getSession(boolean isNew). All other methods delegate to
their implementation in wrapped request object. The getSession() and
getSession(boolean isNew) use special singleton class SessionManager to get
a session object.

I know there is a class org.eclipse.rwt.internal.service.WrappedRequest. And
I was able to use that class instead of mine, but I prefer not to change the
platform classes if it possible (until I will be sure that my fix is fine).

2) About SessionWrapper:

SessionWrapper wraps HttpSession object and uses those storage to save own
data. I use instanceId attribute to save information from different tabs (or
frames).

3) About SessionManager:
This class maps pairs of real HttpSession objects and instanceId strings to
SessionWrapper objects.

And there is some additional fixes:
In org.eclipse.rwt.internal.service.ServiceContext I changed the constructor
to use RequestWrapper instead of real (and wrapped) HttpServiceRequest.
In org.eclipse.rwt.internal.service.LifeCycleServiceHandler I changed the
isSessionRestart method (removed some conditions, that checks if the new
HttpSession object used).

You have to know that due to
org.eclipse.rwt.internal.service.LifeCycleServiceHandler#isSessionRestart
implementation you must use branded entry poins (use, for example,
tea-branding from org.elcipse.rap.branding). The problem of using the
"rap?startup=default" in the fact that the isSessionRestart method use a
startup parameter to check if the session should be restarted.


There is one more thing that you have to know: if you have to implement the
some service handler, you must pass instanceId variable with the (get)
parameters to this service handler. But the fact that I uses "referer"
header to look for the instanceId parameter could reduce the places, where
you have to pass instanceId attribute.


I made some additional changes in my application. For example, I used a
"org.eclipse.equinox.http.registry.resources" where I registered some
additional pages that used a javascript to calculate a new free instanceId
value and passed it to the iframe object. So the user can only type the name
of an application to open it. I can describe how to do this if it is
necessary.


Please, review my patch. Is this a good way to deal with multitab support?
And is it possible to patch RAP js-code to deal with calculation of
instanceId attribute?


Regards,
Igor




Back to the top