I am working on a crawling project. When I do a simple URLConnection connection to the website as shown in below:
URLConnection conn = new URL(url).openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
The method returns the HTML body correctly. However, the website makes inner requests for some fields. For example, the website fetches the total number of users from a different web service. In the web browser, the total number of users appear after some time, but with the URLConnection method does not wait for the total number of users and the returned HTML does not contain such field.
In Java, is there any way to wait for a while to fetch all the data from a website using URLConnection.