New features and Improvements
Last week, I found out that a crash occurred when using Mozilla instead of Chromium browser, which was caused by a memory fault. I was passing a variable from one session to another in the application: In chromium, there was no issue as the first session was destroyed only after a timeout set in wt_config; In Mozilla, the session was immediately destroyed without timeout as the user exits the session.
Anyway, my method of retrieving the variable was poorly done. That’s when I learned about using cookies to share info between session. Turns out that cookie is really easy to implement in Wt.
Wt::WApplication::setCookie(name, value, age)
will create a cookie with a ‘name’ and ‘value’ that expires after ‘age’ seconds. To retrieve it:
Since some people disables cookie in browser, i figure there should be a fallback plan for this.
WResource to replace EntryPoint
There is a url redirection after user login to Google Drive service. I was handling this redirection by setting up an entry point for it. The method had some drawbacks, one of them is the need to increase the entry points if more storage services are added.
It never occurred to me that a WResource can be configured to handle the redirection and using a response status 302. This allows me to :-
- ) Process the redirection first.
- ) Easily add more storage services without affecting the main application.
The WTimer is another new feature implemented. The timer is set based on the user’s access token expiry and triggers a synchronization with the cloud storage. This will reduce the number of API requests and network traffic.