Packages

  • package root
    Definition Classes
    root
  • package sttp
    Definition Classes
    root
  • package model

    Most model classes contain both serialisation & parsing functionality, following these conventions:

    Most model classes contain both serialisation & parsing functionality, following these conventions:

    • .toString returns a representation of the model class in a format as in an HTTP request/response. For example, for an uri this will be http://..., for a header [name]: [value], etc.
    • [SthCompanionObject].parse(serialized: String): Either[String, Sth]: returns an error message or an instance of the model class
    • [SthCompanionObject].unsafeParse(serialized: String): Sth: returns an instance of the model class or in case of an error, *throws an exception*.
    • [SthCompanionObject].unsafeApply(values): creates an instance of the model class; validates the input values and in case of an error, *throws an exception*. An error could be e.g. that the input values contain characters outside of the allowed range
    • [SthCompanionObject].safeApply(...): Either[String, Sth]: same as above, but doesn't throw exceptions. Instead, returns an error message or the model class instance
    • [SthCompanionObject].apply(...): Sth: creates the model type, without validation, and without throwing exceptions
    Definition Classes
    sttp
  • package headers
    Definition Classes
    model
  • package internal
    Definition Classes
    model
  • package sse
    Definition Classes
    model
  • ContentRangeUnits
  • ContentTypeRange
  • Encodings
  • HasHeaders
  • Header
  • HeaderNames
  • Headers
  • HttpVersion
  • MediaType
  • MediaTypes
  • Method
  • Methods
  • Part
  • QueryParams
  • RequestMetadata
  • ResponseMetadata
  • StatusCode
  • StatusCodes
  • StatusText
  • Uri
  • UriInterpolator

case class Uri(scheme: Option[String], authority: Option[Authority], pathSegments: PathSegments, querySegments: Seq[QuerySegment], fragmentSegment: Option[Segment]) extends Product with Serializable

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.

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.

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Uri
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Uri(scheme: Option[String], authority: Option[Authority], pathSegments: PathSegments, querySegments: Seq[QuerySegment], fragmentSegment: Option[Segment])

    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.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addParam(k: String, v: Option[String]): Uri
  5. def addParam(k: String, v: String): Uri
  6. def addParams(ps: (String, String)*): Uri
  7. def addParams(mqp: QueryParams): Uri
  8. def addParams(ps: Map[String, String]): Uri
  9. def addPath(ps: Seq[String]): Uri
  10. def addPath(p: String, ps: String*): Uri
  11. def addPathSegment(s: Segment): Uri
  12. def addPathSegments(ss: Seq[Segment]): Uri
  13. def addPathSegments(s1: Segment, s2: Segment, ss: Segment*): Uri
  14. def addQuerySegment(qs: QuerySegment): Uri
  15. def addQuerySegments(qss: Seq[QuerySegment]): Uri
  16. def addQuerySegments(qs1: QuerySegment, qs2: QuerySegment, qss: QuerySegment*): Uri
  17. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  18. def authority(a: Some[Authority]): Uri

    Replace the authority.

  19. def authority(a: Authority): Uri

    Replace the authority.

  20. val authority: Option[Authority]
  21. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  22. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. def fragment: Option[String]
  24. def fragment(f: Option[String]): Uri

    Replace the fragment.

  25. def fragment(f: String): Uri

    Replace the fragment.

  26. def fragmentSegment(s: Option[Segment]): Uri

    Replace the fragment.

  27. val fragmentSegment: Option[Segment]
  28. def fragmentSegmentEncoding(encoding: Encoding): Uri
  29. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  30. def host: Option[String]
  31. def host(h: String): Uri

    Replace the host.

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

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

    Replace the host.

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

  33. def hostSegment(s: Segment): Uri

    Replace the host.

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

  34. def hostSegmentEncoding(encoding: Encoding): Uri
  35. def isAbsolute: Boolean
  36. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  37. def isRelative: Boolean
  38. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  39. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  40. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  41. def params: QueryParams
  42. def paramsMap: Map[String, String]
  43. def paramsSeq: Seq[(String, String)]
  44. def path: Seq[String]
  45. val pathSegments: PathSegments
  46. def pathSegmentsEncoding(encoding: Encoding): Uri
  47. def port: Option[Int]
  48. def port(p: Option[Int]): Uri

    Replace the port.

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

  49. def port(p: Int): Uri

    Replace the port.

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

  50. val querySegments: Seq[QuerySegment]
  51. def querySegmentsEncoding(encoding: Encoding): Uri

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

  52. def queryValueSegmentsEncoding(valueEncoding: Encoding): Uri

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

  53. def resolve(other: Uri): Uri
  54. def scheme(s: Option[String]): Uri

    Replace the scheme.

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

  55. def scheme(s: String): Uri

    Replace the scheme.

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

  56. val scheme: Option[String]
  57. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  58. def toJavaUri: URI
  59. def toString(): String
    Definition Classes
    Uri → AnyRef → Any
  60. def userInfo: Option[UserInfo]
  61. def userInfo(ui: Option[UserInfo]): Uri

    Replace the user info with username/password combination.

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

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

    Replace the user info with username/password combination.

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

  63. def userInfo(username: String): Uri

    Replace the user info with a username only.

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

  64. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  66. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. def withParam(k: String, v: Option[String]): Uri

    Replace query with the given single optional parameter.

  68. def withParam(k: String, v: String): Uri

    Replace query with the given single parameter.

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

    Replace query with the given parameters.

  70. def withParams(mqp: QueryParams): Uri

    Replace query with the given parameters.

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

    Replace query with the given parameters.

  72. def withPath(ps: Seq[String]): Uri
  73. def withPath(p: String, ps: String*): Uri
  74. def withPathSegment(s: Segment): Uri
  75. def withPathSegments(ss: Seq[Segment]): Uri
  76. def withPathSegments(s1: Segment, s2: Segment, ss: Segment*): Uri
  77. def withWholePath(p: String): Uri

    Replace the whole path with the given one.

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

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated
  2. 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.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addParam or withParam

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

    Adds the given parameter to the query.

    Adds the given parameter to the query.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addParam or withParam

  4. def params(ps: (String, String)*): Uri

    Adds the given parameters to the query.

    Adds the given parameters to the query.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addParam or withParam

  5. def params(mqp: QueryParams): Uri

    Adds the given parameters to the query.

    Adds the given parameters to the query.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addParam or withParam

  6. def params(ps: Map[String, String]): Uri

    Adds the given parameters to the query.

    Adds the given parameters to the query.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addParam or withParam

  7. def path(ps: Seq[String]): Uri

    Replace path with the given path segments.

    Replace path with the given path segments.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addPath, withPath or withWholePath

  8. def path(p1: String, p2: String, ps: String*): Uri

    Replace path with the given path segments.

    Replace path with the given path segments.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addPath, withPath or withWholePath

  9. def path(p: String): Uri

    Replace path with the given single-segment path.

    Replace path with the given single-segment path.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addPath, withPath or withWholePath

  10. def pathSegment(s: Segment): Uri

    Replace path with the given path segment.

    Replace path with the given path segment.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addPath, withPath or withWholePath

  11. def pathSegments(ss: Seq[Segment]): Uri

    Replace path with the given path segments.

    Replace path with the given path segments.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addPath, withPath or withWholePath

  12. def pathSegments(s1: Segment, s2: Segment, ss: Segment*): Uri

    Replace path with the given path segment.

    Replace path with the given path segment.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addPath, withPath or withWholePath

  13. def querySegment(qs: QuerySegment): Uri

    Adds the given query segment.

    Adds the given query segment.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) Use addQuerySegment

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped