The textract directive is not available in the Java API.

textract

Signature

def textract[L: Tuple](f: RequestContext 

Description

Extracts a tuple of values from the request context and provides them to the inner route.

The textract directive is used as a building block for Custom Directives to extract data from the RequestContextRequestContext and provide it to the inner route. To extract just one value use the extract directive. To provide a constant value independent of the RequestContextRequestContext use the tprovide directive instead.

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

See also extract for extracting a single value.

Example

sourceval pathAndQuery = textract { ctx =>
  val uri = ctx.request.uri
  (uri.path, uri.query())
}
val route =
  pathAndQuery { (p, query) =>
    complete(s"The path is $p and the query is $query")
  }

// tests:
Get("/abcdef?ghi=12") ~> route ~> check {
  responseAs[String] shouldEqual "The path is /abcdef and the query is ghi=12"
}