Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Remember Data on page reload
Remember Data on page reload [message #137857] Thu, 25 June 2009 11:24 Go to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6609
Registered: July 2009
Senior Member
Hi,

How do I remember informations when the user reloads the page in the
browser.

Say I open my application with an URL like this:
-------8<-------
http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
-------8<-------

In reality these 2 parameters are passed as post parameters :-) Now my
user wants to switch the language which I implemented by simply
reloading the page and like this:

-------8<-------
parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
-------8<-------

Naturally I can't pass the username and password now because of security
reasons. In standard web-applications I'd restore those informations in
the HttpSession and that's what I thought would be possible also.

So I tried:
- RWT.getSession()
- RWT.getSessionStore()
- RWT.getRequest().getSession()

but it looks like those sessions are clear when ever I reload the page.

So I'm a bit stuck now because my standard Servlet-Knowlege doesn't seem
to work.

Tom
Re: Remember Data on page reload [message #137872 is a reply to message #137857] Thu, 25 June 2009 12:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

take a look at RWT.getSettingStore() and ISettingStore doc?! afaik this mechanism works with cookies, maybe this is a point for further investigations?!

HTH,
-ben



Tom Schindl schrieb:
> Hi,
>
> How do I remember informations when the user reloads the page in the
> browser.
>
> Say I open my application with an URL like this:
> -------8<-------
> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
> -------8<-------
>
> In reality these 2 parameters are passed as post parameters :-) Now my
> user wants to switch the language which I implemented by simply
> reloading the page and like this:
>
> -------8<-------
> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
> -------8<-------
>
> Naturally I can't pass the username and password now because of security
> reasons. In standard web-applications I'd restore those informations in
> the HttpSession and that's what I thought would be possible also.
>
> So I tried:
> - RWT.getSession()
> - RWT.getSessionStore()
> - RWT.getRequest().getSession()
>
> but it looks like those sessions are clear when ever I reload the page.
>
> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't seem
> to work.
>
> Tom
Re: Remember Data on page reload [message #137883 is a reply to message #137872] Thu, 25 June 2009 12:06 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6609
Registered: July 2009
Senior Member
Hi,

I tried it already and it is cleared when I reload the page!

Tom

Ben W. schrieb:
> take a look at RWT.getSettingStore() and ISettingStore doc?! afaik this
> mechanism works with cookies, maybe this is a point for further
> investigations?!
>
> HTH,
> -ben
>
>
>
> Tom Schindl schrieb:
>> Hi,
>>
>> How do I remember informations when the user reloads the page in the
>> browser.
>>
>> Say I open my application with an URL like this:
>> -------8<-------
>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>
>> -------8<-------
>>
>> In reality these 2 parameters are passed as post parameters :-) Now my
>> user wants to switch the language which I implemented by simply
>> reloading the page and like this:
>>
>> -------8<-------
>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>
>> -------8<-------
>>
>> Naturally I can't pass the username and password now because of security
>> reasons. In standard web-applications I'd restore those informations in
>> the HttpSession and that's what I thought would be possible also.
>>
>> So I tried:
>> - RWT.getSession()
>> - RWT.getSessionStore()
>> - RWT.getRequest().getSession()
>>
>> but it looks like those sessions are clear when ever I reload the page.
>>
>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't seem
>> to work.
>>
>> Tom
Re: Remember Data on page reload [message #137904 is a reply to message #137883] Thu, 25 June 2009 12:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

hm, that's odd, since i'm using this mechanism to store login information throughout session.

for example, when logging in i do:

RWT.getSettingStore().setAttribute("username", "bla");
RWT.getSettingStore().setAttribute("password", "blabla");


in a new session i do:

String username = (String) RWT.getSettingStore().getAttribute("username");
String password = (String) RWT.getSettingStore().getAttribute("password");

and then i get the values that have been stored in a previous session.


please distiguish between the RWT.getSETTINGStore() and RWT.getSESSIONStore()...


HTH,
-ben




Tom Schindl schrieb:
> Hi,
>
> I tried it already and it is cleared when I reload the page!
>
> Tom
>
> Ben W. schrieb:
>> take a look at RWT.getSettingStore() and ISettingStore doc?! afaik this
>> mechanism works with cookies, maybe this is a point for further
>> investigations?!
>>
>> HTH,
>> -ben
>>
>>
>>
>> Tom Schindl schrieb:
>>> Hi,
>>>
>>> How do I remember informations when the user reloads the page in the
>>> browser.
>>>
>>> Say I open my application with an URL like this:
>>> -------8<-------
>>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>>
>>> -------8<-------
>>>
>>> In reality these 2 parameters are passed as post parameters :-) Now my
>>> user wants to switch the language which I implemented by simply
>>> reloading the page and like this:
>>>
>>> -------8<-------
>>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>>
>>> -------8<-------
>>>
>>> Naturally I can't pass the username and password now because of security
>>> reasons. In standard web-applications I'd restore those informations in
>>> the HttpSession and that's what I thought would be possible also.
>>>
>>> So I tried:
>>> - RWT.getSession()
>>> - RWT.getSessionStore()
>>> - RWT.getRequest().getSession()
>>>
>>> but it looks like those sessions are clear when ever I reload the page.
>>>
>>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't seem
>>> to work.
>>>
>>> Tom
Re: Remember Data on page reload [message #137916 is a reply to message #137904] Thu, 25 June 2009 13:24 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6609
Registered: July 2009
Senior Member
Hi,

You are sooooo right - I had a typo and really used
RWT.getSESSIONStore() :-)

Tom

Ben W. schrieb:
> hm, that's odd, since i'm using this mechanism to store login
> information throughout session.
>
> for example, when logging in i do:
>
> RWT.getSettingStore().setAttribute("username", "bla");
> RWT.getSettingStore().setAttribute("password", "blabla");
>
>
> in a new session i do:
>
> String username = (String) RWT.getSettingStore().getAttribute("username");
> String password = (String) RWT.getSettingStore().getAttribute("password");
>
> and then i get the values that have been stored in a previous session.
>
>
> please distiguish between the RWT.getSETTINGStore() and
> RWT.getSESSIONStore()...
>
>
> HTH,
> -ben
>
>
>
>
> Tom Schindl schrieb:
>> Hi,
>>
>> I tried it already and it is cleared when I reload the page!
>>
>> Tom
>>
>> Ben W. schrieb:
>>> take a look at RWT.getSettingStore() and ISettingStore doc?! afaik this
>>> mechanism works with cookies, maybe this is a point for further
>>> investigations?!
>>>
>>> HTH,
>>> -ben
>>>
>>>
>>>
>>> Tom Schindl schrieb:
>>>> Hi,
>>>>
>>>> How do I remember informations when the user reloads the page in the
>>>> browser.
>>>>
>>>> Say I open my application with an URL like this:
>>>> -------8<-------
>>>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>>>
>>>>
>>>> -------8<-------
>>>>
>>>> In reality these 2 parameters are passed as post parameters :-) Now my
>>>> user wants to switch the language which I implemented by simply
>>>> reloading the page and like this:
>>>>
>>>> -------8<-------
>>>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>>>
>>>>
>>>> -------8<-------
>>>>
>>>> Naturally I can't pass the username and password now because of
>>>> security
>>>> reasons. In standard web-applications I'd restore those informations in
>>>> the HttpSession and that's what I thought would be possible also.
>>>>
>>>> So I tried:
>>>> - RWT.getSession()
>>>> - RWT.getSessionStore()
>>>> - RWT.getRequest().getSession()
>>>>
>>>> but it looks like those sessions are clear when ever I reload the page.
>>>>
>>>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't
>>>> seem
>>>> to work.
>>>>
>>>> Tom
Re: Remember Data on page reload [message #137928 is a reply to message #137857] Thu, 25 June 2009 13:25 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Tom,

currently all session attributes are removed from the HttpSession.
The ISessionStore is itself an attribute taht is stored in the
HttpSesion.
If you feel that it is a general requirement to have sme attributes
"survive" a session restart, please file an enhancement request.

Meanwhile you could work around this by storing the user information
in a static map. As a key you can use the session id (it doesn't
change with a session restart).
The first login would store user/password in the map under the
session id. A "restart-request" would encounter that there is no
user/password in the request parameters and consult the map.
To save memory, remove the entry from the map when the session is
invalidated.

Another approach would be form based authentication. It should also
work, thou I haven't tried it myself.

HTH
Rüdiger


Tom Schindl wrote:
> Hi,
>
> How do I remember informations when the user reloads the page in the
> browser.
>
> Say I open my application with an URL like this:
> -------8<-------
> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
> -------8<-------
>
> In reality these 2 parameters are passed as post parameters :-) Now my
> user wants to switch the language which I implemented by simply
> reloading the page and like this:
>
> -------8<-------
> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
> -------8<-------
>
> Naturally I can't pass the username and password now because of security
> reasons. In standard web-applications I'd restore those informations in
> the HttpSession and that's what I thought would be possible also.
>
> So I tried:
> - RWT.getSession()
> - RWT.getSessionStore()
> - RWT.getRequest().getSession()
>
> but it looks like those sessions are clear when ever I reload the page.
>
> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't seem
> to work.
>
> Tom
Re: Remember Data on page reload [message #137950 is a reply to message #137916] Thu, 25 June 2009 13:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6609
Registered: July 2009
Senior Member
Hi,

On a site note I think the approach from Rüdiger to use a static mao is
better because the setting store survives sessions (e.g. Browser
restart) which is a bad thing to happen!

Tom

Tom Schindl schrieb:
> Hi,
>
> You are sooooo right - I had a typo and really used
> RWT.getSESSIONStore() :-)
>
> Tom
>
> Ben W. schrieb:
>> hm, that's odd, since i'm using this mechanism to store login
>> information throughout session.
>>
>> for example, when logging in i do:
>>
>> RWT.getSettingStore().setAttribute("username", "bla");
>> RWT.getSettingStore().setAttribute("password", "blabla");
>>
>>
>> in a new session i do:
>>
>> String username = (String) RWT.getSettingStore().getAttribute("username");
>> String password = (String) RWT.getSettingStore().getAttribute("password");
>>
>> and then i get the values that have been stored in a previous session.
>>
>>
>> please distiguish between the RWT.getSETTINGStore() and
>> RWT.getSESSIONStore()...
>>
>>
>> HTH,
>> -ben
>>
>>
>>
>>
>> Tom Schindl schrieb:
>>> Hi,
>>>
>>> I tried it already and it is cleared when I reload the page!
>>>
>>> Tom
>>>
>>> Ben W. schrieb:
>>>> take a look at RWT.getSettingStore() and ISettingStore doc?! afaik this
>>>> mechanism works with cookies, maybe this is a point for further
>>>> investigations?!
>>>>
>>>> HTH,
>>>> -ben
>>>>
>>>>
>>>>
>>>> Tom Schindl schrieb:
>>>>> Hi,
>>>>>
>>>>> How do I remember informations when the user reloads the page in the
>>>>> browser.
>>>>>
>>>>> Say I open my application with an URL like this:
>>>>> -------8<-------
>>>>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>>>>
>>>>>
>>>>> -------8<-------
>>>>>
>>>>> In reality these 2 parameters are passed as post parameters :-) Now my
>>>>> user wants to switch the language which I implemented by simply
>>>>> reloading the page and like this:
>>>>>
>>>>> -------8<-------
>>>>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>>>>
>>>>>
>>>>> -------8<-------
>>>>>
>>>>> Naturally I can't pass the username and password now because of
>>>>> security
>>>>> reasons. In standard web-applications I'd restore those informations in
>>>>> the HttpSession and that's what I thought would be possible also.
>>>>>
>>>>> So I tried:
>>>>> - RWT.getSession()
>>>>> - RWT.getSessionStore()
>>>>> - RWT.getRequest().getSession()
>>>>>
>>>>> but it looks like those sessions are clear when ever I reload the page.
>>>>>
>>>>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't
>>>>> seem
>>>>> to work.
>>>>>
>>>>> Tom
Re: Remember Data on page reload [message #137962 is a reply to message #137928] Thu, 25 June 2009 13:37 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6609
Registered: July 2009
Senior Member
Hi Rüdiger,

Now that you mention it I don't know why I haven't thought of this myself.

I'm going down this path. Thanks for the idea! I'm going to file a
enhancement so that one can probably configure which session variables
should not be cleared.

Tom

Rüdiger Herrmann schrieb:
> Tom,
>
> currently all session attributes are removed from the HttpSession. The
> ISessionStore is itself an attribute taht is stored in the HttpSesion.
> If you feel that it is a general requirement to have sme attributes
> "survive" a session restart, please file an enhancement request.
>
> Meanwhile you could work around this by storing the user information in
> a static map. As a key you can use the session id (it doesn't change
> with a session restart).
> The first login would store user/password in the map under the session
> id. A "restart-request" would encounter that there is no user/password
> in the request parameters and consult the map.
> To save memory, remove the entry from the map when the session is
> invalidated.
>
> Another approach would be form based authentication. It should also
> work, thou I haven't tried it myself.
>
> HTH
> Rüdiger
>
>
> Tom Schindl wrote:
>> Hi,
>>
>> How do I remember informations when the user reloads the page in the
>> browser.
>>
>> Say I open my application with an URL like this:
>> -------8<-------
>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>
>> -------8<-------
>>
>> In reality these 2 parameters are passed as post parameters :-) Now my
>> user wants to switch the language which I implemented by simply
>> reloading the page and like this:
>>
>> -------8<-------
>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>
>> -------8<-------
>>
>> Naturally I can't pass the username and password now because of security
>> reasons. In standard web-applications I'd restore those informations in
>> the HttpSession and that's what I thought would be possible also.
>>
>> So I tried:
>> - RWT.getSession()
>> - RWT.getSessionStore()
>> - RWT.getRequest().getSession()
>>
>> but it looks like those sessions are clear when ever I reload the page.
>>
>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't seem
>> to work.
>>
>> Tom
Re: Remember Data on page reload [message #137974 is a reply to message #137928] Thu, 25 June 2009 13:52 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6609
Registered: July 2009
Senior Member
Hi Rüdiger,

Works like a charme but I'm not sure how I should add a session listener
in context of an RAP-Application.

Do you by chance have a pointer how I do that in an RAP-env? I also have
to register 2 more servlets in the Jetty (to produce PDF and CSV-Files).

So the general question might be how to configure the underlying
Jetty-Instance through extension points.

Tom

Rüdiger Herrmann schrieb:
> Tom,
>
> currently all session attributes are removed from the HttpSession. The
> ISessionStore is itself an attribute taht is stored in the HttpSesion.
> If you feel that it is a general requirement to have sme attributes
> "survive" a session restart, please file an enhancement request.
>
> Meanwhile you could work around this by storing the user information in
> a static map. As a key you can use the session id (it doesn't change
> with a session restart).
> The first login would store user/password in the map under the session
> id. A "restart-request" would encounter that there is no user/password
> in the request parameters and consult the map.
> To save memory, remove the entry from the map when the session is
> invalidated.
>
> Another approach would be form based authentication. It should also
> work, thou I haven't tried it myself.
>
> HTH
> Rüdiger
>
>
> Tom Schindl wrote:
>> Hi,
>>
>> How do I remember informations when the user reloads the page in the
>> browser.
>>
>> Say I open my application with an URL like this:
>> -------8<-------
>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>
>> -------8<-------
>>
>> In reality these 2 parameters are passed as post parameters :-) Now my
>> user wants to switch the language which I implemented by simply
>> reloading the page and like this:
>>
>> -------8<-------
>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>
>> -------8<-------
>>
>> Naturally I can't pass the username and password now because of security
>> reasons. In standard web-applications I'd restore those informations in
>> the HttpSession and that's what I thought would be possible also.
>>
>> So I tried:
>> - RWT.getSession()
>> - RWT.getSessionStore()
>> - RWT.getRequest().getSession()
>>
>> but it looks like those sessions are clear when ever I reload the page.
>>
>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't seem
>> to work.
>>
>> Tom
Re: Remember Data on page reload [message #137990 is a reply to message #137974] Thu, 25 June 2009 14:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: benjamin.wolff.web.de

hi,

using servlets in conjunction with a RAP/server-side equinox application is as easy as can possibly be imagined :PP.
just use the org.eclipse.equinox.http.registry.servlets extension point and point to the servlet class and fill in the other parameters.
you can then use the servlets in an embedded jetty or deployed in a tomcat environmen.


HTH,
-ben



Tom Schindl schrieb:
> Hi Rüdiger,
>
> Works like a charme but I'm not sure how I should add a session listener
> in context of an RAP-Application.
>
> Do you by chance have a pointer how I do that in an RAP-env? I also have
> to register 2 more servlets in the Jetty (to produce PDF and CSV-Files).
>
> So the general question might be how to configure the underlying
> Jetty-Instance through extension points.
>
> Tom
>
> Rüdiger Herrmann schrieb:
>> Tom,
>>
>> currently all session attributes are removed from the HttpSession. The
>> ISessionStore is itself an attribute taht is stored in the HttpSesion.
>> If you feel that it is a general requirement to have sme attributes
>> "survive" a session restart, please file an enhancement request.
>>
>> Meanwhile you could work around this by storing the user information in
>> a static map. As a key you can use the session id (it doesn't change
>> with a session restart).
>> The first login would store user/password in the map under the session
>> id. A "restart-request" would encounter that there is no user/password
>> in the request parameters and consult the map.
>> To save memory, remove the entry from the map when the session is
>> invalidated.
>>
>> Another approach would be form based authentication. It should also
>> work, thou I haven't tried it myself.
>>
>> HTH
>> Rüdiger
>>
>>
>> Tom Schindl wrote:
>>> Hi,
>>>
>>> How do I remember informations when the user reloads the page in the
>>> browser.
>>>
>>> Say I open my application with an URL like this:
>>> -------8<-------
>>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>>
>>> -------8<-------
>>>
>>> In reality these 2 parameters are passed as post parameters :-) Now my
>>> user wants to switch the language which I implemented by simply
>>> reloading the page and like this:
>>>
>>> -------8<-------
>>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>>
>>> -------8<-------
>>>
>>> Naturally I can't pass the username and password now because of security
>>> reasons. In standard web-applications I'd restore those informations in
>>> the HttpSession and that's what I thought would be possible also.
>>>
>>> So I tried:
>>> - RWT.getSession()
>>> - RWT.getSessionStore()
>>> - RWT.getRequest().getSession()
>>>
>>> but it looks like those sessions are clear when ever I reload the page.
>>>
>>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't seem
>>> to work.
>>>
>>> Tom
Re: Remember Data on page reload [message #137999 is a reply to message #137974] Thu, 25 June 2009 14:52 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Tom Schindl wrote:
> Hi Rüdiger,
>
> Works like a charme but I'm not sure how I should add a session listener
> in context of an RAP-Application.
RWT.getSessionStore().addSessionStoreListener()

>
> Do you by chance have a pointer how I do that in an RAP-env? I also have
> to register 2 more servlets in the Jetty (to produce PDF and CSV-Files).
>
> So the general question might be how to configure the underlying
> Jetty-Instance through extension points.
>
> Tom
>
> Rüdiger Herrmann schrieb:
>> Tom,
>>
>> currently all session attributes are removed from the HttpSession. The
>> ISessionStore is itself an attribute taht is stored in the HttpSesion.
>> If you feel that it is a general requirement to have sme attributes
>> "survive" a session restart, please file an enhancement request.
>>
>> Meanwhile you could work around this by storing the user information in
>> a static map. As a key you can use the session id (it doesn't change
>> with a session restart).
>> The first login would store user/password in the map under the session
>> id. A "restart-request" would encounter that there is no user/password
>> in the request parameters and consult the map.
>> To save memory, remove the entry from the map when the session is
>> invalidated.
>>
>> Another approach would be form based authentication. It should also
>> work, thou I haven't tried it myself.
>>
>> HTH
>> Rüdiger
>>
>>
>> Tom Schindl wrote:
>>> Hi,
>>>
>>> How do I remember informations when the user reloads the page in the
>>> browser.
>>>
>>> Say I open my application with an URL like this:
>>> -------8<-------
>>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>>
>>> -------8<-------
>>>
>>> In reality these 2 parameters are passed as post parameters :-) Now my
>>> user wants to switch the language which I implemented by simply
>>> reloading the page and like this:
>>>
>>> -------8<-------
>>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>>
>>> -------8<-------
>>>
>>> Naturally I can't pass the username and password now because of security
>>> reasons. In standard web-applications I'd restore those informations in
>>> the HttpSession and that's what I thought would be possible also.
>>>
>>> So I tried:
>>> - RWT.getSession()
>>> - RWT.getSessionStore()
>>> - RWT.getRequest().getSession()
>>>
>>> but it looks like those sessions are clear when ever I reload the page.
>>>
>>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't seem
>>> to work.
>>>
>>> Tom
Re: Remember Data on page reload [message #138134 is a reply to message #137990] Fri, 26 June 2009 10:40 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6609
Registered: July 2009
Senior Member
Hi,

This works great. Now one final question and I'm totally happy. Do you
know if it possible to somehow modify the main-html page so that I can
add a hidden IFRAME where I redirect file downloads to?

Tom

Ben W. schrieb:
> hi,
>
> using servlets in conjunction with a RAP/server-side equinox application
> is as easy as can possibly be imagined :PP.
> just use the org.eclipse.equinox.http.registry.servlets extension point
> and point to the servlet class and fill in the other parameters.
> you can then use the servlets in an embedded jetty or deployed in a
> tomcat environmen.
>
>
> HTH,
> -ben
>
>
>
> Tom Schindl schrieb:
>> Hi Rüdiger,
>>
>> Works like a charme but I'm not sure how I should add a session listener
>> in context of an RAP-Application.
>>
>> Do you by chance have a pointer how I do that in an RAP-env? I also have
>> to register 2 more servlets in the Jetty (to produce PDF and CSV-Files).
>>
>> So the general question might be how to configure the underlying
>> Jetty-Instance through extension points.
>>
>> Tom
>>
>> Rüdiger Herrmann schrieb:
>>> Tom,
>>>
>>> currently all session attributes are removed from the HttpSession. The
>>> ISessionStore is itself an attribute taht is stored in the HttpSesion.
>>> If you feel that it is a general requirement to have sme attributes
>>> "survive" a session restart, please file an enhancement request.
>>>
>>> Meanwhile you could work around this by storing the user information in
>>> a static map. As a key you can use the session id (it doesn't change
>>> with a session restart).
>>> The first login would store user/password in the map under the session
>>> id. A "restart-request" would encounter that there is no user/password
>>> in the request parameters and consult the map.
>>> To save memory, remove the entry from the map when the session is
>>> invalidated.
>>>
>>> Another approach would be form based authentication. It should also
>>> work, thou I haven't tried it myself.
>>>
>>> HTH
>>> Rüdiger
>>>
>>>
>>> Tom Schindl wrote:
>>>> Hi,
>>>>
>>>> How do I remember informations when the user reloads the page in the
>>>> browser.
>>>>
>>>> Say I open my application with an URL like this:
>>>> -------8<-------
>>>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>>>
>>>>
>>>> -------8<-------
>>>>
>>>> In reality these 2 parameters are passed as post parameters :-) Now my
>>>> user wants to switch the language which I implemented by simply
>>>> reloading the page and like this:
>>>>
>>>> -------8<-------
>>>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>>>
>>>>
>>>> -------8<-------
>>>>
>>>> Naturally I can't pass the username and password now because of
>>>> security
>>>> reasons. In standard web-applications I'd restore those informations in
>>>> the HttpSession and that's what I thought would be possible also.
>>>>
>>>> So I tried:
>>>> - RWT.getSession()
>>>> - RWT.getSessionStore()
>>>> - RWT.getRequest().getSession()
>>>>
>>>> but it looks like those sessions are clear when ever I reload the page.
>>>>
>>>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't
>>>> seem
>>>> to work.
>>>>
>>>> Tom
Re: Remember Data on page reload [message #138158 is a reply to message #138134] Fri, 26 June 2009 11:22 Go to previous message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Tom Schindl wrote:
> Hi,
>
> This works great. Now one final question and I'm totally happy. Do you
> know if it possible to somehow modify the main-html page so that I can
> add a hidden IFRAME where I redirect file downloads to?
You would need a "branding" that - among other things - allows you
to insert HTML snippets into the main page.

See here for the branding documentation:
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .rap.help/help/html/advanced/branding.html
The documentation of the body attribute might be a bit misleading.
You need to specify a file that contains an HTML snippets that goes
into the body element of the page.

>
> Tom
>
> Ben W. schrieb:
>> hi,
>>
>> using servlets in conjunction with a RAP/server-side equinox application
>> is as easy as can possibly be imagined :PP.
>> just use the org.eclipse.equinox.http.registry.servlets extension point
>> and point to the servlet class and fill in the other parameters.
>> you can then use the servlets in an embedded jetty or deployed in a
>> tomcat environmen.
>>
>>
>> HTH,
>> -ben
>>
>>
>>
>> Tom Schindl schrieb:
>>> Hi Rüdiger,
>>>
>>> Works like a charme but I'm not sure how I should add a session listener
>>> in context of an RAP-Application.
>>>
>>> Do you by chance have a pointer how I do that in an RAP-env? I also have
>>> to register 2 more servlets in the Jetty (to produce PDF and CSV-Files).
>>>
>>> So the general question might be how to configure the underlying
>>> Jetty-Instance through extension points.
>>>
>>> Tom
>>>
>>> Rüdiger Herrmann schrieb:
>>>> Tom,
>>>>
>>>> currently all session attributes are removed from the HttpSession. The
>>>> ISessionStore is itself an attribute taht is stored in the HttpSesion.
>>>> If you feel that it is a general requirement to have sme attributes
>>>> "survive" a session restart, please file an enhancement request.
>>>>
>>>> Meanwhile you could work around this by storing the user information in
>>>> a static map. As a key you can use the session id (it doesn't change
>>>> with a session restart).
>>>> The first login would store user/password in the map under the session
>>>> id. A "restart-request" would encounter that there is no user/password
>>>> in the request parameters and consult the map.
>>>> To save memory, remove the entry from the map when the session is
>>>> invalidated.
>>>>
>>>> Another approach would be form based authentication. It should also
>>>> work, thou I haven't tried it myself.
>>>>
>>>> HTH
>>>> Rüdiger
>>>>
>>>>
>>>> Tom Schindl wrote:
>>>>> Hi,
>>>>>
>>>>> How do I remember informations when the user reloads the page in the
>>>>> browser.
>>>>>
>>>>> Say I open my application with an URL like this:
>>>>> -------8<-------
>>>>> http://127.0.0.1:55350/rap?startup=bizerbawb&username=bl abla&password=bloblo
>>>>>
>>>>>
>>>>> -------8<-------
>>>>>
>>>>> In reality these 2 parameters are passed as post parameters :-) Now my
>>>>> user wants to switch the language which I implemented by simply
>>>>> reloading the page and like this:
>>>>>
>>>>> -------8<-------
>>>>> parent.window.location.href=' http://127.0.0.1:55350/rap?startup=bizerbawb&language=de _DE'
>>>>>
>>>>>
>>>>> -------8<-------
>>>>>
>>>>> Naturally I can't pass the username and password now because of
>>>>> security
>>>>> reasons. In standard web-applications I'd restore those informations in
>>>>> the HttpSession and that's what I thought would be possible also.
>>>>>
>>>>> So I tried:
>>>>> - RWT.getSession()
>>>>> - RWT.getSessionStore()
>>>>> - RWT.getRequest().getSession()
>>>>>
>>>>> but it looks like those sessions are clear when ever I reload the page.
>>>>>
>>>>> So I'm a bit stuck now because my standard Servlet-Knowlege doesn't
>>>>> seem
>>>>> to work.
>>>>>
>>>>> Tom
Previous Topic:Combo Widget
Next Topic:RowLayout wrapping issue after structural changes
Goto Forum:
  


Current Time: Mon Dec 06 20:54:17 GMT 2021

Powered by FUDForum. Page generated in 0.02712 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top