Package org.htmlunit

Class WaitingRefreshHandler

  • All Implemented Interfaces:
    RefreshHandler

    public class WaitingRefreshHandler
    extends java.lang.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
      WaitingRefreshHandler()
      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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void handleRefresh​(Page page, java.net.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 Detail

      • 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 Detail

      • handleRefresh

        public void handleRefresh​(Page page,
                                  java.net.URL url,
                                  int requestedWait)
                           throws java.io.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:
        java.io.IOException - if the refresh fails