I'm having kind of a problem with the Apache httpclient for Java. I'm writing a login bot for a website, which extracts all the fields from the login forms, fills in username and password and logs into the account by making a POST request. I tried it using the classes provided by java, but there I got thrown back to the login page every time. It seems to work with the Apache client, but I tried to remove all the cookie handling code to see if it still works. I no longer save cookies in a list and I don't add cookies to the request, but it seems that I'm still getting logged in correctly. How can that be? I don't use a cookiestore and I don't know where the cookies are coming from, so obviously they must be saved somewhere in the background. I need to clear them to start a new session. I create the client like this
CloseableHttpClient client = HttpClients.createDefault();
and make requests like this
HttpPost post = new HttpPost(url+"/login");
HttpResponse response = client.execute(post);