简体   繁体   English

Java用户端的HTTP请求并捕获请求和响应的时间

[英]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). 我需要在Java中创建一个在用户端发送HTTP请求的应用程序,并捕获请求时间,响应时间和打开整个网页所需的时间(无需显示页面)。 ie 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!! 请有人帮我!!

Use java.net.HttpURLConnection to make your request; 使用java.net.HttpURLConnection发出请求; there are plenty of examples. 有很多例子。 And then you can use a System.currentTimeMillis() to capture the time. 然后,您可以使用System.currentTimeMillis()捕获时间。 It should be very simple. 应该很简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM