I am searching for some advise concerning the following situation:
I currently use a HttpsUrlconnection (SSL) to 'successfully' login to a website, the data I need to fetch is JSON (below screenshot as an example).
The login procedure is as follows:
- Perform a GET to grab the (set-cookie) headers (which are 2, JSESSIONID, PD-S-SESSION-ID)
- Perform a POST with my credentials (including these 2 cookies)
- Perform a final GET to retrieve the HTML page (login response is no JSON)
- Grab the customerID which is hidden/provided in the HTML reponse string (only after a successfull login), the ID is needed to be able to grab the actual JSON data which I am looking for.
Due to the fact that the actual data I need is provided in JSON and I still need to start writing the parsing code, I was wondering if I should switch to volley/retrofit as these 2 are much faster then httpurlconnection. I already did some research/code lookup on StackOverflow and the INet about volley/retrofit but I can`t seem to find good examples to perform the login procedure (which I need to do).
Questions so far:
- the website uses redirects (302), can volley/retrofit handle these? Was planning to use 'com.mcxiaoke.volley:library:1.0.19'
- there are 2 set-cookie headers, volley is only able to save 1 set-cookie header (other are overwritten?)
- how to combine a GET, POST and a final GET in volley/retrofit? I only could find examples of 1 GET, 1 POST at the same time. I was planning to use a singleton, as the app constantly should be connected to INet.
My actual problem is to rewrite the login code which I have (HttpsUrlConnection) to volley or retrofit (how to handle the set-cookies, redirects, combine the GET and POST methods which are needed). The actual parsing of the JSON data (once logged in), should be no problem.
Not to be misunderstood. I am not asking to write me some example code. I am just looking for some good guidelines/examples? And is it worth to upgrade/gain the 60-70% speed increase which volley/retrofit should have?
Or should I save the trouble and just stick to my working HttpsUrlConnection asynctask?
Thank you in advance for your advise.