EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Clear OutputStream between two requests

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#29844
Posted: 06/18/2014 11:48:02
by Bogdan H. (Standard support level)
Joined: 04/03/2014
Posts: 10

I use a TElRestClient to fetch data from multiple URLs as JSON. If I make a request to a URL and then a second request to a different URL the ResponseJSON is the JSON from the first request.

How do I "clear the state" between two requests?
#29845
Posted: 06/18/2014 11:51:24
by Eugene Mayevski (EldoS Corp.)

Create a new instance of MemoryStream or equivalent class and set TElRestClient.OutputStream to this instance. The assignment will dispose the existing stream and will take ownership over the new stream. I.e. you don't own the new instance and it will be closed and disposed of automatically when the component is destroyed or when you assign another value to OutputStream.


Sincerely yours
Eugene Mayevski
#29846
Posted: 06/18/2014 12:01:10
by Bogdan H. (Standard support level)
Joined: 04/03/2014
Posts: 10

That solved it. Thank you for the fast reply!
#29847
Posted: 06/18/2014 12:08:13
by Eugene Mayevski (EldoS Corp.)

...But looking into the source code I see that the output stream is re-initialized when you use one of Post or Put methods defined in TElRestClient.

It's not re-initialized when you use those overloads that are inherited from TElHTTPSClient.

So the question is - how exactly do you send the request? What method is used?


Sincerely yours
Eugene Mayevski
#29848
Posted: 06/18/2014 12:14:04
by Eugene Mayevski (EldoS Corp.)

Anyway, we've improved the code (in SBB 12 release) to re-initialize the stream with any request method (even inherited ones) in TElRESTClient.


Sincerely yours
Eugene Mayevski
#29849
Posted: 06/18/2014 12:17:00
by Bogdan H. (Standard support level)
Joined: 04/03/2014
Posts: 10

Great to hear. When will SBB 12 be released?
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

Topic viewed 506 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!