Class Options


  • public final class Options
    extends Object
    A set of options which can be used for customizing the behavior of HTTP clients and servers. Refer to the appropriate class for the list of supported options.
    • Method Detail

      • copyOf

        public static Options copyOf​(Options options)
        Returns a copy of the provided set of options.
        Parameters:
        options - The options to be copied.
        Returns:
        A copy of the provided set of options.
      • defaultOptions

        public static Options defaultOptions()
        Returns a new set of options with default settings.
        Returns:
        A new set of options with default settings.
      • unmodifiableCopyOf

        public static Options unmodifiableCopyOf​(Options options)
        Returns an unmodifiable copy of the provided set of options.
        Parameters:
        options - The options to be copied.
        Returns:
        An unmodifiable copy of the provided set of options.
      • unmodifiableDefaultOptions

        public static Options unmodifiableDefaultOptions()
        Returns an unmodifiable set of options with default settings.
        Returns:
        An unmodifiable set of options with default settings.
      • get

        public <T> T get​(Option<T> option)
        Returns the value associated with the provided option, or its default value if the option has not been configured.
        Type Parameters:
        T - The option type.
        Parameters:
        option - The option whose associated value is to be returned.
        Returns:
        The value associated with the provided option, or its default value if the option has not been configured.
      • reset

        public <T> Options reset​(Option<T> option)
        Resets an option to its default behavior.
        Type Parameters:
        T - The option type.
        Parameters:
        option - The option whose value is to be reset.
        Returns:
        This set of options.
        Throws:
        UnsupportedOperationException - If this set of options is unmodifiable.
      • set

        public <T> Options set​(Option<T> option,
                               T value)
        Sets an option to the provided value. If this set of options previously contained a mapping for the option, the old value is replaced by the specified value.
        Type Parameters:
        T - The option type.
        Parameters:
        option - The option whose value is to be set.
        value - The option value.
        Returns:
        This set of options.
        Throws:
        UnsupportedOperationException - If this set of options is unmodifiable.