Uri

sttp.model.Uri
See theUri companion object
case class Uri(scheme: Option[String], authority: Option[Authority], pathSegments: PathSegments, querySegments: Seq[QuerySegment], fragmentSegment: Option[Segment])

A URI. Can represent both relative and absolute URIs, hence in terms of https://tools.ietf.org/html/rfc3986, this is a URI reference.

All components (scheme, host, query, ...) are stored decoded, and become encoded upon serialization (using toString).

Instances can be created using the uri interpolator: uri"..." (see UriInterpolator), or the factory methods on the Uri companion object.

The apply/safeApply/unsafeApply methods create absolute URIs and require a host. The relative methods creates a relative URI, given path/query/fragment components.

Attributes

querySegments

Either key-value pairs, single values, or plain query segments. Key value pairs will be serialized as k=v, and blocks of key-value pairs/single values will be combined using &. Note that no & or other separators are added around plain query segments - if required, they need to be added manually as part of the plain query segment. Custom encoding logic can be provided when creating a segment.

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def addParam(k: String, v: String): Uri
def addParam(k: String, v: Option[String]): Uri
def addParams(ps: Map[String, String]): Uri
def addParams(ps: (String, String)*): Uri
def addPath(p: String, ps: String*): Uri
def addPath(ps: Seq[String]): Uri
def addPathSegments(ss: Seq[Segment]): Uri

Replace the authority.

Replace the authority.

Attributes

def authority(a: Some[Authority]): Uri

Replace the authority.

Replace the authority.

Attributes

def fragment(f: String): Uri

Replace the fragment.

Replace the fragment.

Attributes

def fragment(f: Option[String]): Uri

Replace the fragment.

Replace the fragment.

Attributes

def fragment: Option[String]
def fragmentSegment(s: Option[Segment]): Uri

Replace the fragment.

Replace the fragment.

Attributes

def host(h: String): Uri

Replace the host. Does not validate the new host value if it's nonempty.

Replace the host. Does not validate the new host value if it's nonempty.

Attributes

def host: Option[String]

Replace the host. Does not validate the new host value if it's nonempty.

Replace the host. Does not validate the new host value if it's nonempty.

Attributes

def hostSegment(s: Option[Segment]): Uri

Replace the host. Does not validate the new host value if it's nonempty.

Replace the host. Does not validate the new host value if it's nonempty.

Attributes

def isAbsolute: Boolean
def isRelative: Boolean
def paramsMap: Map[String, String]
def paramsSeq: Seq[(String, String)]
def path: Seq[String]
def port(p: Int): Uri

Replace the port. Adds an empty host if one is absent.

Replace the port. Adds an empty host if one is absent.

Attributes

def port(p: Option[Int]): Uri

Replace the port. Adds an empty host if one is absent, and port is defined.

Replace the port. Adds an empty host if one is absent, and port is defined.

Attributes

def port: Option[Int]

Replace encoding for query segments: applies to key-value, only-value and plain ones.

Replace encoding for query segments: applies to key-value, only-value and plain ones.

Attributes

Replace encoding for the value part of key-value query segments and for only-value ones.

Replace encoding for the value part of key-value query segments and for only-value ones.

Attributes

def resolve(other: Uri): Uri
def scheme(s: String): Uri

Replace the scheme. Does not validate the new scheme value.

Replace the scheme. Does not validate the new scheme value.

Attributes

def scheme(s: Option[String]): Uri

Replace the scheme. Does not validate the new scheme value.

Replace the scheme. Does not validate the new scheme value.

Attributes

def toJavaUri: URI
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns:

a string representation of the object.

Definition Classes
Any
def userInfo(username: String): Uri

Replace the user info with a username only. Adds an empty host if one is absent.

Replace the user info with a username only. Adds an empty host if one is absent.

Attributes

def userInfo(username: String, password: String): Uri

Replace the user info with username/password combination. Adds an empty host if one is absent.

Replace the user info with username/password combination. Adds an empty host if one is absent.

Attributes

def userInfo(ui: Option[UserInfo]): Uri

Replace the user info with username/password combination. Adds an empty host if one is absent, and user info is defined.

Replace the user info with username/password combination. Adds an empty host if one is absent, and user info is defined.

Attributes

def userInfo: Option[UserInfo]
def withParam(k: String, v: String): Uri

Replace query with the given single parameter.

Replace query with the given single parameter.

Attributes

def withParam(k: String, v: Option[String]): Uri

Replace query with the given single optional parameter.

Replace query with the given single optional parameter.

Attributes

def withParams(ps: Map[String, String]): Uri

Replace query with the given parameters.

Replace query with the given parameters.

Attributes

Replace query with the given parameters.

Replace query with the given parameters.

Attributes

def withParams(ps: (String, String)*): Uri

Replace query with the given parameters.

Replace query with the given parameters.

Attributes

def withPath(p: String, ps: String*): Uri
def withPath(ps: Seq[String]): Uri
def withWholePath(p: String): Uri

Replace the whole path with the given one. Leading / will be removed, if present, and the path will be split into segments on /.

Replace the whole path with the given one. Leading / will be removed, if present, and the path will be split into segments on /.

Attributes

Deprecated methods

def param(k: String, v: String): Uri

Adds the given parameter to the query.

Adds the given parameter to the query.

Attributes

Deprecated
[Since version 1.2.0] Use addParam or withParam
def param(k: String, v: Option[String]): Uri

Adds the given parameter with an optional value to the query if it is present.

Adds the given parameter with an optional value to the query if it is present.

Attributes

Deprecated
[Since version 1.2.0] Use addParam or withParam
def params(ps: Map[String, String]): Uri

Adds the given parameters to the query.

Adds the given parameters to the query.

Attributes

Deprecated
[Since version 1.2.0] Use addParam or withParam

Adds the given parameters to the query.

Adds the given parameters to the query.

Attributes

Deprecated
[Since version 1.2.0] Use addParam or withParam
def params(ps: (String, String)*): Uri

Adds the given parameters to the query.

Adds the given parameters to the query.

Attributes

Deprecated
[Since version 1.2.0] Use addParam or withParam
def path(p: String): Uri

Replace path with the given single-segment path.

Replace path with the given single-segment path.

Attributes

Deprecated
[Since version 1.2.0] Use addPath, withPath or withWholePath
def path(p1: String, p2: String, ps: String*): Uri

Replace path with the given path segments.

Replace path with the given path segments.

Attributes

Deprecated
[Since version 1.2.0] Use addPath, withPath or withWholePath
def path(ps: Seq[String]): Uri

Replace path with the given path segments.

Replace path with the given path segments.

Attributes

Deprecated
[Since version 1.2.0] Use addPath, withPath or withWholePath

Replace path with the given path segment.

Replace path with the given path segment.

Attributes

Deprecated
[Since version 1.2.0] Use addPath, withPath or withWholePath
def pathSegments(s1: Segment, s2: Segment, ss: Segment*): Uri

Replace path with the given path segment.

Replace path with the given path segment.

Attributes

Deprecated
[Since version 1.2.0] Use addPath, withPath or withWholePath
def pathSegments(ss: Seq[Segment]): Uri

Replace path with the given path segments.

Replace path with the given path segments.

Attributes

Deprecated
[Since version 1.2.0] Use addPath, withPath or withWholePath

Adds the given query segment.

Adds the given query segment.

Attributes

Deprecated
[Since version 1.2.0] Use addQuerySegment

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product