Class HttpHook


  • public class HttpHook
    extends Object
    Represents a hook.
    Author:
    https://github.com/ljucam [Mario Ljuca]
    • Field Detail

      • CONNECTION_MAX_WAIT_QUEUE_SIZE_PROPERTY_NAME

        public static final String CONNECTION_MAX_WAIT_QUEUE_SIZE_PROPERTY_NAME
        See Also:
        Constant Field Values
      • CONNECTION_POOL_SIZE_DEFAULT_VALUE

        public static final int CONNECTION_POOL_SIZE_DEFAULT_VALUE
        See Also:
        Constant Field Values
      • CONNECTION_MAX_WAIT_QUEUE_SIZE_DEFAULT_VALUE

        public static final int CONNECTION_MAX_WAIT_QUEUE_SIZE_DEFAULT_VALUE
        See Also:
        Constant Field Values
      • CONNECTION_TIMEOUT_SEC_PROPERTY_NAME

        public static final String CONNECTION_TIMEOUT_SEC_PROPERTY_NAME
        See Also:
        Constant Field Values
      • CONNECTION_TIMEOUT_SEC_DEFAULT_VALUE

        public static final int CONNECTION_TIMEOUT_SEC_DEFAULT_VALUE
        See Also:
        Constant Field Values
    • Constructor Detail

      • HttpHook

        public HttpHook​(String destination)
        Creates a new hook.
        Parameters:
        destination - destination
    • Method Detail

      • getDestination

        public String getDestination()
        The destination of the hook.
        Returns:
        String
      • setDestination

        public void setDestination​(String destination)
        Sets the destination of the hook.
        Parameters:
        destination - destination
      • getMethods

        public List<String> getMethods()
        Returns the methods which should pass the hook.
        Returns:
        a list of HTTP methods or empty, if all methods do pass.
      • setMethods

        public void setMethods​(List<String> methods)
        Sets the methods which should pass the hook.
        Parameters:
        methods - a list of HTTP methods or empty, if all methods do pass.
      • getHeadersFilterPattern

        public Pattern getHeadersFilterPattern()
      • setHeadersFilterPattern

        public void setHeadersFilterPattern​(Pattern headersFilterPattern)
      • addTranslateStatus

        public void addTranslateStatus​(Pattern key,
                                       Integer value)
      • getExpirationTime

        public Optional<org.joda.time.DateTime> getExpirationTime()
        Returns:
        Expiration time of this hook. This is null for hooks with infinite expiration.
      • setExpirationTime

        public void setExpirationTime​(org.joda.time.DateTime expirationTime)
        Sets the expiration time of this hook.
        Parameters:
        expirationTime - expirationTime
      • isFullUrl

        public boolean isFullUrl()
        Returns whether the hook forwards using the full initial url or only the appendix.
        Returns:
        fullUrl
      • setFullUrl

        public void setFullUrl​(boolean fullUrl)
        Sets whether the hook forwards using the full initial url or only the appendix.
        Parameters:
        fullUrl - fullUrl
      • getQueueingStrategy

        public QueueingStrategy getQueueingStrategy()
        Returns the queueing strategy for the hook
        Returns:
        queueingStrategy
      • setQueueingStrategy

        public void setQueueingStrategy​(QueueingStrategy queueingStrategy)
        Sets the queueing strategy for the hook
        Parameters:
        queueingStrategy -
      • getFilter

        public Pattern getFilter()
        Returns the precompiled pattern, to match a given url.
        Returns:
        - a precompiled pattern
      • setFilter

        public void setFilter​(String regex)
        Set a regexp to filter the hook.
        Parameters:
        regex - - a regular expression
      • getQueueExpireAfter

        public int getQueueExpireAfter()
        Gets the expiry (x-queue-expire-after header) for the requests in the queue send to the listener. A -1 means that no expiry is set (the header will not be set).
        Returns:
        a value in seconds
      • setQueueExpireAfter

        public void setQueueExpireAfter​(int queueExpireAfter)
        Sets the expiry (x-queue-expire-after header) for the requests in the queue send to the listener. A -1 means that no expiry is set (the header will not be set!).
        Parameters:
        queueExpireAfter - - a value in seconds
      • getHeaderFunction

        public org.swisspush.gateleen.core.http.HeaderFunction getHeaderFunction()
      • setHeaderFunction

        public void setHeaderFunction​(org.swisspush.gateleen.core.http.HeaderFunction headerFunction)
      • getHookTriggerType

        public HookTriggerType getHookTriggerType()
        Retuns the trigger type of the hook.
        Returns:
        the trigger type of the hook
      • setHookTriggerType

        public void setHookTriggerType​(HookTriggerType hookTriggerType)
        Sets the trigger type of the hook. If nothing is set, the default value is 'before'.
        Parameters:
        hookTriggerType - the trigger type of the hook
      • isListable

        public boolean isListable()
        Indicates if a route hook should be listed for a GET request or not.
        Returns:
        true if the route hook should be listed
      • setListable

        public void setListable​(boolean listable)
        Sets if a route hook should be listed for a GET request or not.
        Parameters:
        listable - true if the route hook should be listed
      • isCollection

        public boolean isCollection()
        Indicates if a hook points to a collection (default: true) or not.
        Returns:
        true (default) if hook points to collection.
      • setCollection

        public void setCollection​(boolean collection)
        Sets if a hook points to a collection (default: true) or not.
        Parameters:
        collection - true (default) if hook points to collection.
      • getConnectionPoolSize

        public Integer getConnectionPoolSize()
        Returns:
        Max count of connections made to configured destination. This may returning null in case there's no value specified. Callers may catch that by fall back to a default.
      • getMaxWaitQueueSize

        public Integer getMaxWaitQueueSize()
        Returns:
        Maximum number of requests allowed in the wait queue. This may returning null in case there's no value specified. Callers may catch that by fall back to a default.
      • getTimeout

        @Nullable
        public Integer getTimeout()
        Returns:
        Timeout for request in milliseconds. Defines the time up until an ongoing request will be aborted if there was no reply given before. This may returning null in case there's no value specified. Callers may catch that by fall back to a default.
      • getProxyOptions

        public io.vertx.core.net.ProxyOptions getProxyOptions()
        Get custom proxy options for this hook
        Returns:
        Custom proxy options or null
      • setProxyOptions

        public void setProxyOptions​(io.vertx.core.net.ProxyOptions proxyOptions)
        Set custom proxy options for this hook
        Parameters:
        proxyOptions - the custom proxy options to set