简体   繁体   English

Scala + Akka http-如何使用path指令匹配整个URL

[英]scala + akka http - how to match entire url with path directive

I have a url 我有一个网址

http://localhost:8080/api/search/lookup?limit=3000&m=airid.appname.mapping {appname=*} http:// localhost:8080 / api / search / lookup?limit = 3000&m = airid.appname.mapping {appname = *}

path("api"/"search"/"lookup?limit=3000&m=appname.server.mapping") is unavailable path("api"/"search"/"lookup?limit=3000&m=appname.server.mapping")不可用

how to match the entire url including parameters and values? 如何匹配整个网址,包括参数和值?

The part of the url after the '?' 网址中“?”之后的部分 is referred to as the query string and is technically not part of the path: 称为查询字符串 ,从技术上讲,它不是路径的一部分:

a query string is the part of a uniform resource locator (URL) containing data that does not fit conveniently into a hierarchical path structure 查询字符串是统一资源定位器(URL)的一部分,该URL包含不适合分层路径结构的数据

Therefore, you cannot access it using the path directive . 因此,您不能使用path指令访问它。 If you want the entire uri then you need extractUri : 如果您想要整个uri,则需要extractUri

val myRoute = extractUri { uri =>
  //rest of Route logic
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM