uPortal 2.3.2
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.3 $
Author:
Kazem Naderi

Constructor Summary
AddressTester(int milliSeconds, java.lang.String urlString)
          Constructor
AddressTester(java.lang.String urlString)
          Constructor
 
Method Summary
 void checkURL()
          This method uses an annymous inner thread class and attepmts receving some response codes from the specified URLString
 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(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

checkURL

public void checkURL()
              throws java.lang.Exception
This method uses an annymous inner thread class and attepmts receving some response codes from the specified URLString

Throws:
java.lang.Exception

getResponseCode

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

Returns:
the response code

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.3.2
API Documentation