Class Url

  • All Implemented Interfaces:
    Recyclable

    public class Url
    extends java.lang.Object
    implements Recyclable
    A complete URL, with scheme, host, port, path and query string.
    • Constructor Summary

      Constructors 
      Constructor Description
      Url()  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void copyFrom​(Url other)  
      void fillFrom​(java.lang.CharSequence uriString)
      Deprecated.
      void fillFrom​(java.net.URI uri)
      Fills all attributes of Url from URI instance, also updates full
      void fillFrom​(java.net.URL url)
      Fills all attributes of Url from URL instance, also updates full
      java.lang.StringBuilder getFull()
      The full, possibly agent-assembled URL of the request, e.g https://example.com:443/search?q=elasticsearch#top.
      java.lang.String getHostname()
      The hostname of the request, e.g.
      java.lang.String getPathname()
      The path of the request, e.g.
      int getPort()
      The port of the request, e.g.
      java.lang.String getProtocol()
      The protocol of the request, e.g.
      java.lang.String getSearch()
      The search describes the query string of the request.
      boolean hasContent()  
      void parseAndFillFromFull()
      Parses the full property as URL and populates individual properties
      void resetState()
      resets pooled object state so it can be reused
      Url withFull​(java.lang.CharSequence value)
      Sets the full URL from an arbitrary string.
      Url withHostname​(java.lang.String hostname)
      The hostname of the request, e.g.
      Url withPathname​(java.lang.String pathname)
      The path of the request, e.g.
      Url withPort​(int port)
      The port of the request, e.g.
      Url withProtocol​(java.lang.String protocol)
      The protocol of the request, e.g.
      Url withSearch​(java.lang.String search)
      The search describes the query string of the request.
      • Methods inherited from class java.lang.Object

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

      • Url

        public Url()
    • Method Detail

      • getProtocol

        @Nullable
        public java.lang.String getProtocol()
        The protocol of the request, e.g. 'https:'.
      • withProtocol

        public Url withProtocol​(@Nullable
                                java.lang.String protocol)
        The protocol of the request, e.g. 'https:'.
      • getFull

        public java.lang.StringBuilder getFull()
        The full, possibly agent-assembled URL of the request, e.g https://example.com:443/search?q=elasticsearch#top.
      • withFull

        public Url withFull​(java.lang.CharSequence value)
        Sets the full URL from an arbitrary string. The value is only parsed if the URL might contain user credentials for sanitizing, otherwise it's copied as-is without allocation.
        Parameters:
        value - full URL
        Returns:
        this
      • getHostname

        @Nullable
        public java.lang.String getHostname()
        The hostname of the request, e.g. 'example.com'.
      • withHostname

        public Url withHostname​(@Nullable
                                java.lang.String hostname)
        The hostname of the request, e.g. 'example.com'.
      • getPort

        public int getPort()
        The port of the request, e.g. 443
      • withPort

        public Url withPort​(int port)
        The port of the request, e.g. 443
      • getPathname

        @Nullable
        public java.lang.String getPathname()
        The path of the request, e.g. '/search'
      • withPathname

        public Url withPathname​(@Nullable
                                java.lang.String pathname)
        The path of the request, e.g. '/search'
      • getSearch

        @Nullable
        public java.lang.String getSearch()
        The search describes the query string of the request. It is expected to have values delimited by ampersands.
      • withSearch

        public Url withSearch​(@Nullable
                              java.lang.String search)
        The search describes the query string of the request. It is expected to have values delimited by ampersands.
      • fillFrom

        public void fillFrom​(java.net.URI uri)
        Fills all attributes of Url from URI instance, also updates full
        Parameters:
        uri - URI
      • fillFrom

        public void fillFrom​(java.net.URL url)
        Fills all attributes of Url from URL instance, also updates full
        Parameters:
        url - URL
      • fillFrom

        @Deprecated
        public void fillFrom​(java.lang.CharSequence uriString)
        Deprecated.
      • parseAndFillFromFull

        public void parseAndFillFromFull()
        Parses the full property as URL and populates individual properties
      • resetState

        public void resetState()
        Description copied from interface: Recyclable
        resets pooled object state so it can be reused
        Specified by:
        resetState in interface Recyclable
      • copyFrom

        public void copyFrom​(Url other)
      • hasContent

        public boolean hasContent()