Package org.htmlunit

Class NiceRefreshHandler

  • All Implemented Interfaces:
    java.io.Serializable, RefreshHandler

    public class NiceRefreshHandler
    extends ImmediateRefreshHandler
    This refresh handler performs an immediate refresh if the refresh delay is less or equal to the configured time and otherwise ignores totally the refresh instruction.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      NiceRefreshHandler​(int maxDelay)
      Creates a new refresh handler that will immediately refresh if the refresh delay is no longer than maxDelay.
    • 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 immediately if the requestedWait is not larger than the maxDelay.
      • Methods inherited from class java.lang.Object

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

      • NiceRefreshHandler

        public NiceRefreshHandler​(int maxDelay)
        Creates a new refresh handler that will immediately refresh if the refresh delay is no longer than maxDelay. No refresh will be perform at all for refresh values larger than maxDelay.
        Parameters:
        maxDelay - the maximum refreshValue (in seconds) that should cause a refresh
    • 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 immediately if the requestedWait is not larger than the maxDelay. Does nothing otherwise.
        Specified by:
        handleRefresh in interface RefreshHandler
        Overrides:
        handleRefresh in class ImmediateRefreshHandler
        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
        Throws:
        java.io.IOException - if the refresh fails