Package com.ftpix.webwatcher
Class WebWatcher<T extends WebSite>
- java.lang.Object
-
- com.ftpix.webwatcher.WebWatcher<T>
-
-
Method Summary
Modifier and Type Method Description WebWatcherbodyOnly(boolean bodyOnly)To set whether the content checking is only happening from the body tag and ignore changes in the header note that this parameter is overriden is aWebSitehas a css selectorvoidcheck()Trigger the website checkvoidcheckPeriodically(int intervalInSeconds)trigger the website watch periodically (blocking)booleanisCheckLoopRunning()WebWatcheronChange(WebSiteListener<T> listener)A listener to do something when the website changesWebWatcheronError(WebSiteErrorListener<T> errorListener)a listener to handle errorsvoidsetCheckLoopRunning(boolean checkLoopRunning)WebWatchertextOnly(boolean textOnly)To set whether the content checking is only on the visible text (true) or the html structure (false)WebWatchertriggerEventOnFirstCheck(boolean triggerEvent)Whetehr or not to trigger event if the website has never been checked beforestatic WebWatcherwatch(String... urls)Watch a list of websitesstatic <U extends WebSite>
WebWatcherwatch(U... sites)Watch a list of websites
-
-
-
Method Detail
-
watch
public static WebWatcher watch(String... urls)
Watch a list of websites- Parameters:
urls- a list of URLs to watch- Returns:
- a new web watcher for the given websites
-
watch
public static <U extends WebSite> WebWatcher watch(U... sites)
Watch a list of websites- Parameters:
sites- a list of sites to watch- Returns:
- a new web watcher for the given websites
-
triggerEventOnFirstCheck
public WebWatcher triggerEventOnFirstCheck(boolean triggerEvent)
Whetehr or not to trigger event if the website has never been checked before- Parameters:
triggerEvent- the flag- Returns:
- itself
-
onChange
public WebWatcher onChange(WebSiteListener<T> listener)
A listener to do something when the website changes- Parameters:
listener- a listener to do something when a website changes- Returns:
- itself
-
onError
public WebWatcher onError(WebSiteErrorListener<T> errorListener)
a listener to handle errors- Parameters:
errorListener- an error listener to add to the watcher- Returns:
- itself
-
textOnly
public WebWatcher textOnly(boolean textOnly)
To set whether the content checking is only on the visible text (true) or the html structure (false)- Parameters:
textOnly- defaults to false- Returns:
- itself
-
bodyOnly
public WebWatcher bodyOnly(boolean bodyOnly)
To set whether the content checking is only happening from the body tag and ignore changes in the header note that this parameter is overriden is aWebSitehas a css selector- Parameters:
bodyOnly- defaults to false- Returns:
- itself
-
check
public void check()
Trigger the website check
-
isCheckLoopRunning
public boolean isCheckLoopRunning()
-
setCheckLoopRunning
public void setCheckLoopRunning(boolean checkLoopRunning)
-
checkPeriodically
public void checkPeriodically(int intervalInSeconds) throws InterruptedExceptiontrigger the website watch periodically (blocking)- Parameters:
intervalInSeconds- the delay in seconds between each checks- Throws:
InterruptedException- if the sleep fails
-
-