public void calcResponseTime()
{
String urlStr = "test.jsp";
if (!urlStr.toLowerCase().startsWith("http:"))
{
urlStr = "http://127.0.0.1:8080/webapp" + urlStr;
}
long testTime = 0;
long startTime = System.currentTimeMillis();
try
{
URL url = new URL(urlStr);
URLConnection connection = url.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String inputLine = "";
inputLine = in.readLine();
if (inputLine != null)
{
if (inputLine.indexOf("error") >= 0)
{
testTime = 1500;
}
}
} catch (MalformedURLException ex)
{
} catch (IOException ex)
{
}
responseTime = testTime + System.currentTimeMillis() - startTime;
}