Delphi XE5 REST / Android客户端“会话已过期” [英] Delphi XE5 REST/Android Client "Session has expired"
问题描述
我在 Deplhi Xe5
Android客户端成功与Rest服务器连接。
在我的服务器中,我有一个 TDSHttpWebDispatcher
和 SessionTimeout
= 1200000(20分钟)
因此,当android中的用户超过20分钟未使用该应用程序时,
在向REST服务器发出请求时会收到会话已过期错误。 / p>
我已经在 DSRestConnection
中设置了 PresserveSessionId = False
在客户端应用程序中,因此没有sessiontimeout错误,但是它会使应用程序变慢,因为对于REST服务器的每个请求都会创建一个新会话。
我想保持 PresserveSessionId = True
以获得更好的性能,并且当会话过期(20分钟后)时,捕获会话已过期错误并为客户端请求新的会话
我该如何实现?
谢谢
对不起,我的英语!希望您能读懂
此此处。显而易见的解决方法是在每次调用时创建一个 Try..Except
块,并在该特定异常上请求一个新的会话。
I have a REST Server
with an Android Client
, both on Deplhi Xe5
The android client succesfully connects with the Rest server.
In my server I have a TDSHttpWebDispatcher
with SessionTimeout
=1200000 (20 min)
So when the user in android doesn't use the app for more than 20 min, gets the "Session has expired" error when do a request to the REST server.
I already set the PresserveSessionId=False
in the DSRestConnection
in the Client app, so there is no sessiontimeout error, but it makes the app slower, because for every request to the REST server it creates a new session.
I wanna keep the PresserveSessionId=True
for better performance, and when the session expires (after 20 min) catch the "Session has expired" error and request for a new session for the client
How can i achieve that?
Thanks
Sorry for my english!, hope it is readable
There is an open QC report on this here. The obvious work around would be to create a Try..Except
block on each call and on that specific exception request a new session.
这篇关于Delphi XE5 REST / Android客户端“会话已过期”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!