Phase 1: I succesfully confirm the user password in a web form using HttpClient and HttpPost. In this case, the code I receive from the server is 200OK. Phase 2: Now, let's say the user will attempt to confirm his password again. But he can't do that, because the initial URL won't exist anymore, so he will be redirected to the login page. Here's a bit of a difficulty: in this case, server responds again with 200OK, not a redirect code. How can I differentiate between the first phase and the second? I tried
serverResponse.getStatusLine().getStatusCode();
and
serverResponse.getLastHeader("Location").getValue();
without luck, as there's no real redirect happening from the server point of view. I thought about getting the response content and parsing it as html, but I believe that's not a good solution. I also thought about storing in a boolean SharedPreference the confirmation action, but then there's the case when the user has multiple devices. Another possible solution is to hide the confirm password fragment, once the user confirms his password. What do you think it would be a good way to differentiate between phases or to prevent phase 2? I appreciate any idea. Thank you.