The tprovide directive is not available in the Java API.

tprovide

Signature

def tprovide[L: Tuple](values: L): Directive[L]

Description

Provides a tuple of values to the inner route.

The tprovide directive is used as a building block for Custom Directives to provide data to the inner route. To provide just one value use the provide directive. If you want to provide values calculated from the RequestContextRequestContext use the textract directive instead.

See Providing Values to Inner Routes for an overview of similar directives.

See also provide for providing a single value.

Example

sourcedef provideStringAndLength(value: String) = tprovide((value, value.length))
val route =
  provideStringAndLength("test") { (value, len) =>
    complete(s"Value is $value and its length is $len")
  }

// tests:
Get("/") ~> route ~> check {
  responseAs[String] shouldEqual "Value is test and its length is 4"
}
Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.