Class TimeoutHeader

    • Constructor Detail

      • TimeoutHeader

        public TimeoutHeader​(long timeout)
    • Method Detail

      • getTimeout

        public long getTimeout()
      • parse

        public static TimeoutHeader parse​(javax.servlet.http.HttpServletRequest request,
                                          long defaultValue)
        Parses the request timeout header and converts it into a new TimeoutHeader object.
        The default value is used as fallback if the String is not parseable.
        Parameters:
        request -
        defaultValue -
        Returns:
        a new TimeoutHeader object.
      • parse

        public static long parse​(String timeoutStr,
                                 long defaultValue)
        Parses the given timeout String and converts the timeout value into a long indicating the number of milliseconds until expiration time is reached.
        NOTE: If the timeout String equals to 'infinite' Integer.MAX_VALUE is returned. If the Sting is invalid or is in an invalid format that cannot be parsed, the default value is returned.
        Parameters:
        timeoutStr -
        defaultValue -
        Returns:
        long representing the timeout present in the header or the default value if the header is missing or could not be parsed.