Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » SettingStore not working between AppSvr cycles(SettingStore not retrieving cookies as expected)
SettingStore not working between AppSvr cycles [message #1102984] Fri, 06 September 2013 09:13 Go to next message
John Gymer is currently offline John GymerFriend
Messages: 191
Registered: November 2012
Location: UK
Senior Member
I have some issues using SettingStore, which should be storing Cookies for retrieval later. The behaviour varies a little depending upon browser, but IE is worst, so will use that as the example...

If I have my RAP application running (from within Eclipse, or standalone OSGi, or WAR deployed in some other container), I use SettingStore to save a key pair.

- Within the same session I can retrieve the value ok.
- If I REFRESH the browser to start again, it also works ok and value is retrieved.
- If I open a 2nd IE, this one also retrieves the value ok.

However:
- If I close all IE instances, open a new one, it does NOT retrieve ok

In Chrome and Firefox the above behaviour works as expected... but...

In all types of browsers, if I cycle the AppServer, none of them retrieve the value - it is as if there is no cookie stored at all.

Any idea whether this is a bug in RAP, or some other setting somewhere?

The behaviour is the same for RAP 2.1 and 2.2 M1 nightly from earlier this week.

The code is simple:

to store the value:
myValue = RWT.getSettingStore().getAttribute("myProperty");

to retrieve the key value:
RWT.getSettingStore().setAttribute("myProperty", myValue);

Thanks,
John


---
Just because you can doesn't mean you should
Re: SettingStore not working between AppSvr cycles [message #1103112 is a reply to message #1102984] Fri, 06 September 2013 11:41 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1854
Registered: July 2009
Senior Member
Hi John,
I did some testing by restating the Jetty from my IDE. The file with the
settings is stored here:
...Workspace\.metadata\.plugins\org.eclipse.pde.core\<launch config
name>\org.eclipse.osgi\bundles\6\data\jettywork\pid_1544803905\proxytemp\hc_8377580\org.eclipse.rap.rwt.service.FileSettingStore\<storeID>
When Jetty is restarted the directory "proxytemp" is deleted and created
again, where the subfolder "hc_8377580" has a different name. As a
result the file with settings is gone.
Look at FileSettingStoreFactory#selectWorkingDir() for details how this
folder is selected/created. In this case the folder is obtained from
servlet context tempDir, which chages all the time.
If you want a fixed directory you could set it as servlet context init
attribute (see FileSettingStore.FILE_SETTING_STORE_DIR).
HTH,
Ivan

On 9/6/2013 12:13 PM, John Gymer wrote:
> I have some issues using SettingStore, which should be storing Cookies
> for retrieval later. The behaviour varies a little depending upon
> browser, but IE is worst, so will use that as the example...
>
> If I have my RAP application running (from within Eclipse, or
> standalone OSGi, or WAR deployed in some other container), I use
> SettingStore to save a key pair.
>
> - Within the same session I can retrieve the value ok.
> - If I REFRESH the browser to start again, it also works ok and value
> is retrieved.
> - If I open a 2nd IE, this one also retrieves the value ok.
>
> However:
> - If I close all IE instances, open a new one, it does NOT retrieve ok
>
> In Chrome and Firefox the above behaviour works as expected... but...
>
> In all types of browsers, if I cycle the AppServer, none of them
> retrieve the value - it is as if there is no cookie stored at all.
>
> Any idea whether this is a bug in RAP, or some other setting somewhere?
>
> The behaviour is the same for RAP 2.1 and 2.2 M1 nightly from earlier
> this week.
>
> The code is simple:
>
> to store the value:
> myValue = RWT.getSettingStore().getAttribute("myProperty");
>
> to retrieve the key value:
> RWT.getSettingStore().setAttribute("myProperty", myValue);
>
> Thanks,
> John
>

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: SettingStore not working between AppSvr cycles [message #1103229 is a reply to message #1103112] Fri, 06 September 2013 14:10 Go to previous messageGo to next message
John Gymer is currently offline John GymerFriend
Messages: 191
Registered: November 2012
Location: UK
Senior Member
Thanks Ivan, that's really useful - I'll take a look at FileSettingStore.FILE_SETTING_STORE_DIR


---
Just because you can doesn't mean you should
Re: SettingStore not working between AppSvr cycles [message #1117544 is a reply to message #1103229] Thu, 26 September 2013 14:56 Go to previous messageGo to next message
John Gymer is currently offline John GymerFriend
Messages: 191
Registered: November 2012
Location: UK
Senior Member
Hi Ivan,

Not had a chance to look further into this, but finally now looking again.
Do you have an example of how to specify this init parm in the web.xml?

I've added:

...
    <init-param>
      <param-name>FileSettingStore#FILE_SETTING_STORE_DIR</param-name>
      <param-value>c:/temp/RapideWorkDir/</param-value>     
    </init-param>
...


...as an initial test, but it isn't clear whether it is being used. Certainly a cycle of the appsvr still results in the RWT.getSettingStore().getAttribute("myAttribute") returning nothing, as if it has all been wiped as, same as previously.

Sorry if I'm being thick about the format of the parm in the xml, but I've not played with anything inside the web.xml before, so your help greatly appreciated.

Assuming I'm close the having it working, how does the value itself work? Does it have to be an explicit path, or can it be relative to something?

Thanks, John (maybe barking up the wrong tree)



---
Just because you can doesn't mean you should
Re: SettingStore not working between AppSvr cycles [message #1117638 is a reply to message #1117544] Thu, 26 September 2013 16:57 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1854
Registered: July 2009
Senior Member
Hi John,
the value of FileSettingStore#FILE_SETTING_STORE_DIR parameter is
"org.eclipse.rap.rwt.service.FileSettingStore.dir".
....
<init-param>
<param-name>org.eclipse.rap.rwt.service.FileSettingStore.dir</param-name>
<param-value>c:/temp/RapideWorkDir/</param-value>
</init-param>
....
HTH,
Ivan

On 9/26/2013 5:56 PM, John Gymer wrote:
> Hi Ivan,
>
> Not had a chance to look further into this, but finally now looking
> again.
> Do you have an example of how to specify this init parm in the web.xml?
>
> I've added:
>
>
> ..
> <init-param>
> <param-name>FileSettingStore#FILE_SETTING_STORE_DIR</param-name>
> <param-value>c:/temp/RapideWorkDir/</param-value> </init-param>
> ..
>
>
> ..as an initial test, but it isn't clear whether it is being used.
> Certainly a cycle of the appsvr still results in the
> RWT.getSettingStore().getAttribute("myAttribute") returning nothing,
> as if it has all been wiped as, same as previously.
>
> Sorry if I'm being thick about the format of the parm in the xml, but
> I've not played with anything inside the web.xml before, so your help
> greatly appreciated.
>
> Assuming I'm close the having it working, how does the value itself
> work? Does it have to be an explicit path, or can it be relative to
> something?
>
> Thanks, John (maybe barking up the wrong tree)
>
>

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: SettingStore not working between AppSvr cycles [message #1118355 is a reply to message #1117638] Fri, 27 September 2013 10:20 Go to previous message
John Gymer is currently offline John GymerFriend
Messages: 191
Registered: November 2012
Location: UK
Senior Member
Thanks Ivan.
I'm actually rather confused how this is used in reality.
For now I've coded a different way (Cookies, as you suggested in another thread), and I think it is all work as I want anyway.
Cheers, John


---
Just because you can doesn't mean you should
Previous Topic:RAP JavaScriptExecutor and returning values
Next Topic:RAP Disable Back Browser Button
Goto Forum:
  


Current Time: Mon Nov 24 21:50:43 GMT 2014

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

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