Class HostNameFilter

java.lang.Object
services.moleculer.service.MoleculerComponent
services.moleculer.service.Service
All Implemented Interfaces:
Runnable, services.moleculer.service.MoleculerLifecycle, HttpConstants

public class HostNameFilter extends IpFilter implements Runnable
The HostNameFilter adds the ability to allow or block requests based on the host name of the client. Sample:
HostNameFilter filter = new HostNameFilter();
filter.allow("domain.server**");
route.use(filter);
  • Field Details

  • Constructor Details

    • HostNameFilter

      public HostNameFilter()
    • HostNameFilter

      public HostNameFilter(String... allow)
  • Method Details

    • getAddress

      protected String getAddress(WebRequest req)
      Overrides:
      getAddress in class IpFilter
    • started

      public void started(services.moleculer.ServiceBroker broker) throws Exception
      Specified by:
      started in interface services.moleculer.service.MoleculerLifecycle
      Overrides:
      started in class services.moleculer.service.MoleculerComponent
      Throws:
      Exception
    • stopped

      public void stopped()
      Specified by:
      stopped in interface services.moleculer.service.MoleculerLifecycle
      Overrides:
      stopped in class services.moleculer.service.MoleculerComponent
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • getCleanup

      public int getCleanup()
      Returns:
      the cleanup
    • setCleanup

      public void setCleanup(int cleanup)
      Parameters:
      cleanup - the cleanup to set
    • getTimeout

      public int getTimeout()
      Returns:
      the timeout
    • setTimeout

      public void setTimeout(int timeout)
      Parameters:
      timeout - the timeout to set