Interface LoadEventMount

  • All Implemented Interfaces:
    ai.platon.pulsar.skeleton.plugin.PluginMount

    
    public interface LoadEventMount
     implements PluginMount
                        

    Mount point for load-phase event handlers.

    The PluginManager calls configureLoadHandlers with the active LoadEventHandlers chain, allowing the plugin to register handlers on any load-phase hook:

    • onNormalize — URL normalization

    • onWillLoad — before URL loading

    • onWillFetch — before fetching

    • onFetched — after fetch completes

    • onWillParse — before parsing

    • onWillParseHTMLDocument — before HTML document parsing

    • onHTMLDocumentParsed — after HTML document parsing (data extraction)

    • onParsed — parsing complete

    • onLoaded — page fully loaded

    class MyPlugin : LoadEventMount {
        override fun configureLoadHandlers(handlers: LoadEventHandlers) {
            handlers.onNormalize.addLast { url ->
                url.replace(Regex("\\?utm_.*"), "")
            }
            handlers.onHTMLDocumentParsed.addLast { page, doc ->
                extractData(page, doc)
            }
        }
    }
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Unit configureLoadHandlers(LoadEventHandlers handlers) Called by PluginManager to let this plugin register handlers on any load-phase event hook.
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • configureLoadHandlers

         abstract Unit configureLoadHandlers(LoadEventHandlers handlers)

        Called by PluginManager to let this plugin register handlers on any load-phase event hook.

        Parameters:
        handlers - the active load event handlers chain (never null at call time)