Class Href

  • All Implemented Interfaces:
    CharSequence

    public final class Href
    extends Object
    implements CharSequence
    HTTP URI/HREF.

    The class is immutable and thread-safe.

    Since:
    0.7
    • Constructor Detail

      • Href

        public Href()
        Ctor.
      • Href

        public Href​(CharSequence txt)
        Ctor.
        Parameters:
        txt - Text of the link
    • Method Detail

      • charAt

        public char charAt​(int index)
        Specified by:
        charAt in interface CharSequence
      • path

        public String path()
        Get path part of the HREF.
        Returns:
        Path
        Since:
        0.9
      • bare

        public String bare()
        Get URI without params.
        Returns:
        Bare URI
        Since:
        0.14
      • param

        public Iterable<String> param​(Object key)
        Get query param.
        Parameters:
        key - Param name
        Returns:
        Values (could be empty)
        Since:
        0.9
      • path

        public Href path​(Object suffix)
        Add this path to the URI.
        Parameters:
        suffix - The suffix
        Returns:
        New HREF
      • with

        public Href with​(Object key,
                         Object value)
        Add this extra param.
        Parameters:
        key - Key of the param
        value - The value
        Returns:
        New HREF
      • without

        public Href without​(Object key)
        Without this query param.
        Parameters:
        key - Key of the param
        Returns:
        New HREF