Search code examples
javahttptimerequestresponse

HTTP request at user-end in java and capture time of request and response


i need to create an application in java that sends a HTTP request at user end and capture time of request, time of response and time taken to open the full webpage(no need to display page). i.e the amount of time from the last byte of the request that i send until the first byte of the response that i receive and secondly the time until the entire response is received(full webpage opens)... please somebody help me out!!!

wt i mean is to develop a application just like a web browser which doesn't display web page but time responses!! plz someone help me out!!


Solution

  • Use java.net.HttpURLConnection to make your request; there are plenty of examples. And then you can use a System.currentTimeMillis() to capture the time. It should be very simple.