uPortal 2.4.1
API Documentation

org.jasig.portal.utils
Class AddressTester

java.lang.Object
  extended byorg.jasig.portal.utils.AddressTester

public class AddressTester
extends java.lang.Object

This class checks a URL or a webserver hosting a URL. It only allows a specific time allocated for connecting to the URL rather than waiting for a timeout. This class uses the java.util.Timer to schedule a task which is cancelling the attempt of calling httpURLConnection.

Since:
uPortal 2.2
Version:
$Revision: 1.6 $
Author:
Kazem Naderi

Constructor Summary
AddressTester(int milliSeconds, java.lang.String urlString)
          Constructor
AddressTester(java.lang.String urlString)
          Constructor
AddressTester(java.lang.String urlString, boolean getHead)
          Constructor
AddressTester(java.lang.String urlString, int milliSeconds, boolean getHead)
          Constructor
 
Method Summary
 void disconnect()
          Shut down the connection
 java.net.URLConnection getConnection()
          Get the (valid) URL connection
 int getResponseCode()
          This method returns the response code that was set in checkURL ()
static void main(java.lang.String[] args)
          This is the main method and is left as a usage sample
 boolean URLAvailable()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddressTester

public AddressTester(java.lang.String urlString,
                     int milliSeconds,
                     boolean getHead)
              throws java.lang.Exception
Constructor

Parameters:
milliSeconds - the number of milliseconds to let the connectioon attempt run
urlString - the String representing a URL
getHead - use setRequestMathod("HEAD")

AddressTester

public AddressTester(java.lang.String urlString,
                     boolean getHead)
              throws java.lang.Exception
Constructor

Parameters:
urlString -
getHead -
Throws:
java.lang.Exception

AddressTester

public AddressTester(int milliSeconds,
                     java.lang.String urlString)
              throws java.lang.Exception
Constructor

Parameters:
milliSeconds - - the number of milliseconds to let the connectioon attempt run
urlString - - the String representing a URL

AddressTester

public AddressTester(java.lang.String urlString)
              throws java.lang.Exception
Constructor

Parameters:
urlString - the String representing a URL
Method Detail

getResponseCode

public int getResponseCode()
This method returns the response code that was set in checkURL ()

Returns:
the response code

getConnection

public java.net.URLConnection getConnection()
Get the (valid) URL connection

Returns:
URL connection

disconnect

public void disconnect()
Shut down the connection


URLAvailable

public boolean URLAvailable()
Returns:
false if the address is not available. True otherwise

main

public static void main(java.lang.String[] args)
This is the main method and is left as a usage sample

Parameters:
args -

uPortal 2.4.1
API Documentation