Class Listener


  • public class Listener
    extends java.lang.Object
    Represents a listener.
    Author:
    https://github.com/ljucam [Mario Ljuca]
    • Constructor Summary

      Constructors 
      Constructor Description
      Listener​(java.lang.String listenerId, java.lang.String monitoredUrl, java.lang.String listener, HttpHook hook)
      Creates a new instance of a HookListener.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Integer getExpireAfter()
      Returns the expire after time, for the request header.
      HttpHook getHook()
      Returns the hook of this listener.
      java.lang.String getListener()
      Returns the listener segment of the url.
      java.lang.String getListenerId()
      Returns the listener id (eg.
      java.lang.String getMonitoredUrl()
      Returns the url the listener is hooked up.
      void setExpireAfter​(java.lang.Integer expireAfter)
      Sets the expire after time, for the request header.
      void setHook​(HttpHook hook)
      Sets the hook of this listener.
      void setListener​(java.lang.String listener)
      Sets the listener segment of the url.
      void setListenerId​(java.lang.String listenerId)
      Sets the listener id (eg.
      void setMonitoredUrl​(java.lang.String monitoredUrl)
      Sets the url the listener is hooked up.
      • Methods inherited from class java.lang.Object

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

      • Listener

        public Listener​(java.lang.String listenerId,
                        java.lang.String monitoredUrl,
                        java.lang.String listener,
                        HttpHook hook)
        Creates a new instance of a HookListener.
        Parameters:
        listenerId - - id of the listener eg. "http/colin/12345678".
        monitoredUrl - - URL segment before "/hooks/v1/listeners/", eg. for "PUT http://bus.local/gps/v1/_hooks/listeners/http/colin/12345678" it is "http://bus.local/gps/v1".
        listener - - URL segment after the monitoredUrl "http://bus.local/gps/v1" and without the hook area. eg. for "PUT http://bus.local/gps/v1/_hooks/listeners/http/colin/12345678" it is "http/colin/12345678". If it's a local listener, this can also be the target url.
        hook - - the hook of this listener
    • Method Detail

      • getListener

        public java.lang.String getListener()
        Returns the listener segment of the url.
        Returns:
        String
      • setListener

        public void setListener​(java.lang.String listener)
        Sets the listener segment of the url.
        Parameters:
        listener - listener
      • getMonitoredUrl

        public java.lang.String getMonitoredUrl()
        Returns the url the listener is hooked up.
        Returns:
        String
      • setMonitoredUrl

        public void setMonitoredUrl​(java.lang.String monitoredUrl)
        Sets the url the listener is hooked up.
        Parameters:
        monitoredUrl - monitoredUrl
      • getListenerId

        public java.lang.String getListenerId()
        Returns the listener id (eg. http/colin/123)
        Returns:
        id of the listener
      • setListenerId

        public void setListenerId​(java.lang.String listenerId)
        Sets the listener id (eg. http/colin/123).
        Parameters:
        listenerId - listenerId
      • getExpireAfter

        public java.lang.Integer getExpireAfter()
        Returns the expire after time, for the request header. Can be null if not set.
        Returns:
        expire after time
      • setExpireAfter

        public void setExpireAfter​(java.lang.Integer expireAfter)
        Sets the expire after time, for the request header. Can be null if not set.
        Parameters:
        expireAfter - expireAfter
      • getHook

        public HttpHook getHook()
        Returns the hook of this listener.
        Returns:
        the hook
      • setHook

        public void setHook​(HttpHook hook)
        Sets the hook of this listener.
        Parameters:
        hook - hook