0

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!!

rahul
  • 195
  • 3
  • 5
  • 12
  • 1
    What have you tried so far? What API are you planning to use? What kind of app ore you making? A web app? A desktop app? An applet? You say it's in Java, but then you say "full webpage opens". Do you plan to open the webpage in Java code? – Marko Topolnik Apr 30 '12 at 08:11
  • 1
    You should first search on the internet and try something yourself. then let us know what you have searched or what you've tried. There are certainly many recourse on the web on this topic like [this](http://stackoverflow.com/questions/1359689/how-to-send-http-request-in-java) – Tariq M Nasim Apr 30 '12 at 08:12
  • I have to make an application at the user end...an aplication only dedicated to check this thing only...I need not to display the webpage just need to show time of request, response and time it would take in opening full webpages... – rahul May 01 '12 at 02:24
  • I had made all the gui part...all the coding I needed...just have the problem in time concept and http request forwarding... – rahul May 01 '12 at 02:25
  • i am searching on net for 4 days....but can't find anything appropriate.... till now wt i have found out is that using java.net library and methods like System.currentTimeMillis() could be useful... I am just a beginner at JAVA and dont know much abt the libraries and methods... plz guide me thru...thanks in anticipation!! – rahul May 01 '12 at 05:35
  • please its urgent....somebody plz help me out!! am badly struck on this – rahul May 02 '12 at 05:16
  • 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. – Francis Upton IV May 02 '12 at 05:41
  • @Francis Upton, yeah that was simple, thanks, i have done that, now the problem lies with the part of capturing the time taken by a webpage to open plus i have to find out the net speed, and check if there are any breaking of net connection!! – rahul May 03 '12 at 04:36

1 Answers1

0

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.

Francis Upton IV
  • 18,850
  • 3
  • 50
  • 55
  • yeah that was simple, thanks, i have done that, now the problem lies with the part of capturing the time taken by a webpage to open plus i have to find out the net speed, and check if there are any breaking of net connection!! – rahul May 03 '12 at 04:36
  • You can check that the connection breaks by catching an exception. And you can check the time of the webpage by measuring when you get the first byte, and then measuring when you have finished reading the entire page. – Francis Upton IV May 03 '12 at 04:58
  • Sir, that's the major problem, if i go for reading the webpage that would give me the source code....but i need the time that would be taken in opening the web page ie in opening the whole GUI!! – rahul May 03 '12 at 07:09