Stateless server without sessions
Tuesday, 30 January 2018 · 4 messages · last reply 1 Feb 2018
CG
Christoph Gaukel30 Jan 2018 21:26 #
Hi Team,
i designed a service that uses web tokens to identify the users and i try to run this service really stateless, that says without creating any sessions. The service runs as basexhttp and uses Jetty. Is there a parameter, that prevents it from creating sessions at all?
Quoted text · 1 line
Currently curl writes:
< HTTP/1.1 406 Not Acceptable
< *Set-Cookie: JSESSIONID=1tgnabd2l6y3p1jpg8qv3hb53d;Path=/* < Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Content-Type: text/plain;charset=UTF-8
< Content-Length: 19
< Server: Jetty(8.1.18.v20150929)
and the service adds a new session per call:
sessions: "1gnn17n91gsmuc9grvk417ne 1xim2bo4bmtvr11e4a8tap8cl8 kiy3rq9j5lyq1hf6gf8vy4td2 s5luvfkvdpjv19ikpzqeev9k2
mn50c33fxflz17jv24oc68baw 1tgnabd2l6y3p1jpg8qv3hb53d"
Best regards,
Christoph
CG
Christian Grün31 Jan 2018 12:49 #
Dear Christoph,
I’m glad to read that you are still working with BaseX. I checked our code base, and I noticed that the default session creation in RESTXQ was introduced with the introduction of the %rest:single annotation in version 8.4 [1,2].
I will check out if we can simply get rid of the session creation in version 9 (for those cases in which in which no %rest:single annotation is specified). Would this work for you, or do you require a solution for the stable 8.x version?
All the best,
Christian
[1] http://docs.basex.org/wiki/RESTXQ#Query_Execution
[2] https://github.com/BaseXdb/basex/commit/e7c1ea0db109e43fa6865bd5072107c91c20a574#diff-f914db4b28b8d297df0bfd071c25d8a4
Quoted text · Christoph Gaukel · 28 lines
On Tue, Jan 30, 2018 at 9:26 PM, Christoph Gaukel <christoph.gaukel at gmx.de> wrote: > Hi Team, > > i designed a service that uses web tokens to identify the users and i try to > run this service really stateless, that says without creating any sessions. > The service runs as basexhttp and uses Jetty. Is there a parameter, that > prevents it from creating sessions at all? > > Currently curl writes: > > < HTTP/1.1 406 Not Acceptable > < Set-Cookie: JSESSIONID=1tgnabd2l6y3p1jpg8qv3hb53d;Path=/ > < Expires: Thu, 01 Jan 1970 00:00:00 GMT > < Content-Type: text/plain;charset=UTF-8 > < Content-Length: 19 > < Server: Jetty(8.1.18.v20150929) > > and the service adds a new session per call: > > sessions: "1gnn17n91gsmuc9grvk417ne 1xim2bo4bmtvr11e4a8tap8cl8 > kiy3rq9j5lyq1hf6gf8vy4td2 s5luvfkvdpjv19ikpzqeev9k2 > mn50c33fxflz17jv24oc68baw 1tgnabd2l6y3p1jpg8qv3hb53d" > > > Best regards, > > Christoph
CG
Christoph Gaukel31 Jan 2018 21:21 #
Dear Christian,
Version 9 will work for me! Creating needless sessions means a small overhead in space, bandwidth and calculation time. No problem to live with for some weeks or even months. But I wonder if only the annotation %rest:single uses sessions. For me it would be fine if there was an explicit switch to omit them.
Best regards
Christoph
Quoted text · Christian Grün · 48 lines
Am 31.01.2018 um 12:49 schrieb Christian Grün: > Dear Christoph, > > I’m glad to read that you are still working with BaseX. I checked our > code base, and I noticed that the default session creation in RESTXQ > was introduced with the introduction of the %rest:single annotation in > version 8.4 [1,2]. > > I will check out if we can simply get rid of the session creation in > version 9 (for those cases in which in which no %rest:single > annotation is specified). Would this work for you, or do you require a > solution for the stable 8.x version? > > All the best, > Christian > > [1] http://docs.basex.org/wiki/RESTXQ#Query_Execution > [2] https://github.com/BaseXdb/basex/commit/e7c1ea0db109e43fa6865bd5072107c91c20a574#diff-f914db4b28b8d297df0bfd071c25d8a4 > > > On Tue, Jan 30, 2018 at 9:26 PM, Christoph Gaukel > <christoph.gaukel at gmx.de> wrote: >> Hi Team, >> >> i designed a service that uses web tokens to identify the users and i try to >> run this service really stateless, that says without creating any sessions. >> The service runs as basexhttp and uses Jetty. Is there a parameter, that >> prevents it from creating sessions at all? >> >> Currently curl writes: >> >> < HTTP/1.1 406 Not Acceptable >> < Set-Cookie: JSESSIONID=1tgnabd2l6y3p1jpg8qv3hb53d;Path=/ >> < Expires: Thu, 01 Jan 1970 00:00:00 GMT >> < Content-Type: text/plain;charset=UTF-8 >> < Content-Length: 19 >> < Server: Jetty(8.1.18.v20150929) >> >> and the service adds a new session per call: >> >> sessions: "1gnn17n91gsmuc9grvk417ne 1xim2bo4bmtvr11e4a8tap8cl8 >> kiy3rq9j5lyq1hf6gf8vy4td2 s5luvfkvdpjv19ikpzqeev9k2 >> mn50c33fxflz17jv24oc68baw 1tgnabd2l6y3p1jpg8qv3hb53d" >> >> >> Best regards, >> >> Christoph
CG
Christian Grün1 Feb 2018 08:32 #
Hi Christoph,
I absolutely agree that it would be good to avoid sessions if they are not required, or requested by the client.
And I’m positive that the new snapshot already does what we want [1]: Sessions will only be created now if %rest:single is specified, or if one of the Session(s) Module functions [2] will be invoked in the RESTXQ code.
Hope this helps,
Christian
[1] http://files.basex.org/releases/latest/
[2] http://docs.basex.org/wiki/Session_Module
Quoted text · Christoph Gaukel · 71 lines
On Wed, Jan 31, 2018 at 9:21 PM, Christoph Gaukel <christoph.gaukel at gmx.de> wrote: > Dear Christian, > > Version 9 will work for me! Creating needless sessions means a small > overhead in space, bandwidth and calculation time. No problem to live with > for some weeks or even months. But I wonder if only the annotation > %rest:single uses sessions. For me it would be fine if there was an explicit > switch to omit them. > > Best regards > > Christoph > > > > Am 31.01.2018 um 12:49 schrieb Christian Grün: >> >> Dear Christoph, >> >> I’m glad to read that you are still working with BaseX. I checked our >> code base, and I noticed that the default session creation in RESTXQ >> was introduced with the introduction of the %rest:single annotation in >> version 8.4 [1,2]. >> >> I will check out if we can simply get rid of the session creation in >> version 9 (for those cases in which in which no %rest:single >> annotation is specified). Would this work for you, or do you require a >> solution for the stable 8.x version? >> >> All the best, >> Christian >> >> [1] http://docs.basex.org/wiki/RESTXQ#Query_Execution >> [2] >> https://github.com/BaseXdb/basex/commit/e7c1ea0db109e43fa6865bd5072107c91c20a574#diff-f914db4b28b8d297df0bfd071c25d8a4 >> >> >> On Tue, Jan 30, 2018 at 9:26 PM, Christoph Gaukel >> <christoph.gaukel at gmx.de> wrote: >>> >>> Hi Team, >>> >>> i designed a service that uses web tokens to identify the users and i try >>> to >>> run this service really stateless, that says without creating any >>> sessions. >>> The service runs as basexhttp and uses Jetty. Is there a parameter, that >>> prevents it from creating sessions at all? >>> >>> Currently curl writes: >>> >>> < HTTP/1.1 406 Not Acceptable >>> < Set-Cookie: JSESSIONID=1tgnabd2l6y3p1jpg8qv3hb53d;Path=/ >>> < Expires: Thu, 01 Jan 1970 00:00:00 GMT >>> < Content-Type: text/plain;charset=UTF-8 >>> < Content-Length: 19 >>> < Server: Jetty(8.1.18.v20150929) >>> >>> and the service adds a new session per call: >>> >>> sessions: "1gnn17n91gsmuc9grvk417ne 1xim2bo4bmtvr11e4a8tap8cl8 >>> kiy3rq9j5lyq1hf6gf8vy4td2 s5luvfkvdpjv19ikpzqeev9k2 >>> mn50c33fxflz17jv24oc68baw 1tgnabd2l6y3p1jpg8qv3hb53d" >>> >>> >>> Best regards, >>> >>> Christoph > >
Written for BaseX 8.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery