Package org.htmlunit

Class WaitingRefreshHandler

java.lang.Object
org.htmlunit.WaitingRefreshHandler
All Implemented Interfaces:
RefreshHandler

public class WaitingRefreshHandler extends Object implements RefreshHandler
This refresh handler waits the specified number of seconds (or a user defined maximum) before refreshing the specified page, using the specified URL. Waiting happens on the current thread

If you want a refresh handler that ignores the wait time, see ImmediateRefreshHandler.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new refresh handler that will always wait whatever time the server or content asks.
    WaitingRefreshHandler(int maxwait)
    Creates a new refresh handler that will wait whatever time the server or content asks, unless it it longer than maxwait.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleRefresh(Page page, URL url, int requestedWait)
    Refreshes the specified page using the specified URL after the specified number of seconds.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WaitingRefreshHandler

      public WaitingRefreshHandler(int maxwait)
      Creates a new refresh handler that will wait whatever time the server or content asks, unless it it longer than maxwait. A value of maxwait that is less than 1 will cause the refresh handler to always wait for whatever time the server or content requests.
      Parameters:
      maxwait - the maximum wait time before the refresh (in seconds)
    • WaitingRefreshHandler

      public WaitingRefreshHandler()
      Creates a new refresh handler that will always wait whatever time the server or content asks.
  • Method Details

    • handleRefresh

      public void handleRefresh(Page page, URL url, int requestedWait) throws IOException
      Refreshes the specified page using the specified URL after the specified number of seconds.
      Specified by:
      handleRefresh in interface RefreshHandler
      Parameters:
      page - the page that is going to be refreshed
      url - the URL where the new page will be loaded
      requestedWait - the number of seconds to wait before reloading the page; if this is greater than maxwait then maxwait will be used instead
      Throws:
      IOException - if the refresh fails