org.apache.cactus.integration.ant.util
Class HttpProbe

java.lang.Object
  extended by org.apache.cactus.integration.ant.util.HttpProbe

public class HttpProbe
extends java.lang.Object

Support class that probes a URL.

Version:
$Id: HttpProbe.java,v 1.0 2005/08/29 10:19:57 xnguyen Exp $

Constructor Summary
HttpProbe(java.net.URL theUrl)
          Constructor.
 
Method Summary
 int testConnectivity()
          Tests whether we are able to connect to the HTTP server identified by the specified URL.
 boolean timeout(long theWaitedTime, long theCheckedInterval)
          In thread tests whether we are able to connect to the HTTP server identified by the specified URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpProbe

public HttpProbe(java.net.URL theUrl)
Constructor.

Parameters:
theUrl - The Url
Method Detail

timeout

public boolean timeout(long theWaitedTime,
                       long theCheckedInterval)
                throws java.lang.InterruptedException,
                       java.io.IOException
In thread tests whether we are able to connect to the HTTP server identified by the specified URL. The caller thread is blocked.

Parameters:
theWaitedTime - The time waiting
theCheckedInterval - The interval to check
Returns:
the HTTP response code or -1 if no connection could be established
Throws:
java.lang.InterruptedException - If the current Thread is interupted
java.io.IOException - If there is error with reading

testConnectivity

public int testConnectivity()
                     throws java.io.IOException
Tests whether we are able to connect to the HTTP server identified by the specified URL.

Returns:
the HTTP response code or -1 if no connection could be established
Throws:
java.io.IOException - If there is reading error


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.