Class Uri

java.lang.Object
akka.http.javadsl.model.Uri
Direct Known Subclasses:
JavaUri

public abstract class Uri extends Object
Represents an Uri. Use methods on the class to create modified copies of a given instance.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Uri
    Creates a default Uri to be modified using the modification methods.
    static final Uri.ParsingMode
     
    static final Uri.ParsingMode
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Uri()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract Uri
    Returns a copy of this instance with a path segment added at the end.
    abstract Uri
    Returns the Scala DSL representation of this Uri.
    static Uri
    create(Uri uri)
    Returns the Java DSL representation of a Scala DSL Uri.
    static Uri
    Returns a Uri created by parsing the given string representation.
    static Uri
    create(String uri, Uri.ParsingMode parsingMode)
    Returns a Uri created by parsing the given string representation with the provided parsing mode.
    static Uri
    create(String uri, Charset charset, Uri.ParsingMode parsingMode)
    Returns a Uri created by parsing the given string representation with the provided charset and parsing mode.
    abstract Optional<String>
    Returns the fragment part of this Uri.
    abstract Uri
    fragment(String fragment)
    Returns a copy of this instance with a new fragment.
    abstract Uri
    Returns a copy of this instance with a new optional fragment.
    abstract Host
    Returns the host of this instance
    abstract String
    Returns the path of this instance
    abstract int
    Returns the port of this instance
    abstract String
    Returns the scheme of this instance
    abstract String
    Returns the user info of this instance
    abstract Host
    Returns the Host of this Uri.
    abstract Uri
    host(Host host)
    Returns a copy of this instance with a new Host.
    abstract Uri
    host(String host)
    Returns a copy of this instance with a new host.
    abstract boolean
    Returns if this is an absolute Uri.
    abstract boolean
    Returns if this is an empty Uri.
    abstract boolean
    Returns if this is a relative Uri.
    abstract String
    Returns a String representation of the path of this Uri.
    abstract Uri
    path(String path)
    Returns a copy of this instance with a new path.
    abstract Iterable<String>
    Returns the path segments of this Uri as an Iterable.
    abstract int
    Returns the port of this Uri.
    abstract Uri
    port(int port)
    Returns a copy of this instance with a new port.
    abstract Query
    Returns the parsed Query instance of this Uri.
    abstract Uri
    query(Query query)
    Returns a copy of this instance with a new query.
    abstract Query
    query(Charset charset, Uri.ParsingMode mode)
    Returns the parsed Query instance of this Uri using the given charset and parsing mode.
    abstract Optional<String>
    Returns a decoded String representation of the query of this Uri.
    abstract Optional<String>
    Returns an undecoded String representation of the query of this Uri.
    abstract Uri
    Returns a copy of this instance with a new query.
    abstract Uri
    rawQueryString(String rawQuery, boolean strict)
    Returns a copy of this instance with a new query.
    abstract String
    Returns the scheme of this Uri.
    abstract Uri
    scheme(String scheme)
    Returns a copy of this instance with a new scheme.
    abstract Uri
    Returns a copy of this instance that is relative.
    abstract String
    Returns the user-info of this Uri.
    abstract Uri
    userInfo(String userInfo)
    Returns a copy of this instance with new user-info.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • STRICT

      public static final Uri.ParsingMode STRICT
    • RELAXED

      public static final Uri.ParsingMode RELAXED
    • EMPTY

      public static final Uri EMPTY
      Creates a default Uri to be modified using the modification methods.
  • Constructor Details

    • Uri

      public Uri()
  • Method Details

    • isAbsolute

      public abstract boolean isAbsolute()
      Returns if this is an absolute Uri.
    • isRelative

      public abstract boolean isRelative()
      Returns if this is a relative Uri.
    • isEmpty

      public abstract boolean isEmpty()
      Returns if this is an empty Uri.
    • scheme

      public abstract String scheme()
      Returns the scheme of this Uri.
    • host

      public abstract Host host()
      Returns the Host of this Uri.
    • port

      public abstract int port()
      Returns the port of this Uri.
    • userInfo

      public abstract String userInfo()
      Returns the user-info of this Uri.
    • path

      public abstract String path()
      Returns a String representation of the path of this Uri.
    • pathSegments

      public abstract Iterable<String> pathSegments()
      Returns the path segments of this Uri as an Iterable.
    • queryString

      public abstract Optional<String> queryString(Charset charset)
      Returns a decoded String representation of the query of this Uri.
    • rawQueryString

      public abstract Optional<String> rawQueryString()
      Returns an undecoded String representation of the query of this Uri.
    • query

      public abstract Query query()
      Returns the parsed Query instance of this Uri.
    • query

      public abstract Query query(Charset charset, Uri.ParsingMode mode)
      Returns the parsed Query instance of this Uri using the given charset and parsing mode.
    • fragment

      public abstract Optional<String> fragment()
      Returns the fragment part of this Uri.
    • scheme

      public abstract Uri scheme(String scheme)
      Returns a copy of this instance with a new scheme.
    • host

      public abstract Uri host(Host host)
      Returns a copy of this instance with a new Host.
    • host

      public abstract Uri host(String host)
      Returns a copy of this instance with a new host.
    • port

      public abstract Uri port(int port)
      Returns a copy of this instance with a new port.
    • userInfo

      public abstract Uri userInfo(String userInfo)
      Returns a copy of this instance with new user-info.
    • path

      public abstract Uri path(String path)
      Returns a copy of this instance with a new path.
    • addPathSegment

      public abstract Uri addPathSegment(String segment)
      Returns a copy of this instance with a path segment added at the end.
    • rawQueryString

      public abstract Uri rawQueryString(String rawQuery)
      Returns a copy of this instance with a new query. Characters that are not within the range described at https://tools.ietf.org/html/rfc3986#section-3.4 should be percent-encoded. Characters that are in that range may or may not be percent-encoded, and depending on how the query string is parsed this might be relevant: for example, when interpreting the query string as 'key=value' pairs you could use the percent-encoded '=' ('%22) to include a '=' in the key or value. When characters are encountered that are outside of the RFC3986 range they are automatically percent-encoded, but be aware that relying on this is usually a programming error.
    • rawQueryString

      public abstract Uri rawQueryString(String rawQuery, boolean strict)
      Returns a copy of this instance with a new query. Characters that are not within the range described at https://tools.ietf.org/html/rfc3986#section-3.4 should be percent-encoded. Characters that are in that range may or may not be percent-encoded, and depending on how the query string is parsed this might be relevant: for example, when interpreting the query string as 'key=value' pairs you could use the percent-encoded '=' ('%22) to include a '=' in the key or value.
      Parameters:
      strict - depending on the 'strict' flag, characters outside of the range allowed by RFC3986 will either cause a `IllegalUriException` or be automatically percent-encoded. Be aware that relying on automatic percent-encoding is usually a programming error.
    • query

      public abstract Uri query(Query query)
      Returns a copy of this instance with a new query.
    • toRelative

      public abstract Uri toRelative()
      Returns a copy of this instance that is relative.
    • fragment

      public abstract Uri fragment(String fragment)
      Returns a copy of this instance with a new fragment.
    • fragment

      public abstract Uri fragment(Optional<String> fragment)
      Returns a copy of this instance with a new optional fragment.
    • getScheme

      public abstract String getScheme()
      Returns the scheme of this instance
    • getHost

      public abstract Host getHost()
      Returns the host of this instance
    • getPort

      public abstract int getPort()
      Returns the port of this instance
    • getUserInfo

      public abstract String getUserInfo()
      Returns the user info of this instance
    • getPathString

      public abstract String getPathString()
      Returns the path of this instance
    • asScala

      public abstract Uri asScala()
      Returns the Scala DSL representation of this Uri.
    • create

      public static Uri create(String uri)
      Returns a Uri created by parsing the given string representation.
    • create

      public static Uri create(Uri uri)
      Returns the Java DSL representation of a Scala DSL Uri.
    • create

      public static Uri create(String uri, Uri.ParsingMode parsingMode)
      Returns a Uri created by parsing the given string representation with the provided parsing mode.
    • create

      public static Uri create(String uri, Charset charset, Uri.ParsingMode parsingMode)
      Returns a Uri created by parsing the given string representation with the provided charset and parsing mode.