#51 2016-06-20 09:57:14

George
Member
Registered: 2016-04-05
Posts: 142

Re: JSON RESTful web api from DataSnap to mORMot

I changed class definition from:

TSQLAuthUserEx = class(TSQLAuthUser)
  public
    SessionData: string;
  end;

to

  TSQLAuthUserEx = class(TSQLAuthUser)
  private
    fSessionData: string;
  published
    property SessionData: string read fSessionData write fSessionData;
  end;

Now my methods SetDataToUserSession, GetDataFromUserSession works.

Offline

#52 2016-06-20 11:41:38

George
Member
Registered: 2016-04-05
Posts: 142

Re: JSON RESTful web api from DataSnap to mORMot

Does framework automatically delete session objects from ORM when session timeout happen?
Or i must inherit server class and use OnSessionClosed event?

For test purpose i set SQLAuthGroup.SessionTimeout := 1.
Client app was successfully authenticated and authorized which mean, SessionTimeout was applied.
Next, from client i call server method SetDataToUserSession which save string on server side to TSQLAuthUserEx.SessionData field, then i close client app.
After 2 min i connect again and call GetDataFromUserSession.
SessionData still exists..

Offline

#53 2016-06-20 12:00:03

oz
Member
Registered: 2015-09-02
Posts: 98

Re: JSON RESTful web api from DataSnap to mORMot

You are storing the data (fSessionData) to the TSQLAuthUser object, not in session context here.
Have a look at "ServiceContext: TServiceRunningContext;" declaration in mORMot.pas to read more about session context.

Last edited by oz (2016-06-20 12:05:37)

Offline

#54 2016-06-20 12:23:52

George
Member
Registered: 2016-04-05
Posts: 142

Re: JSON RESTful web api from DataSnap to mORMot

Yes, you right. Thanks.

Offline

#55 2016-08-16 22:04:54

George
Member
Registered: 2016-04-05
Posts: 142

Re: JSON RESTful web api from DataSnap to mORMot

Hello!

I found that my test project was included in ThirdPartyDemos, which is not bad smile
But it's modified version. would be correct if source code will be moved to author folder (Alf?).
Besides, this url not work: https://github.com/LongDirtyAnimAlf/mORMot.REST

If "\ThirdPartyDemos\George\REST-Tester" folder will persist, i would like to see unchanged source.
For example, there should be as well "Win32/Debug/enable_https" folder with test certificate and bat files to install/uninstall it.
I have problems with free time currently, but in future, possibly, i will upload some updates to my git repository (there is few undone 2do entries).

Offline

Board footer

Powered by FluxBB