Playframework 2.0 playframework获取URL+;play.api.libs.ws.ws.WSRequest的查询字符串
我有此要求:Playframework 2.0 playframework获取URL+;play.api.libs.ws.ws.WSRequest的查询字符串,playframework-2.0,Playframework 2.0,我有此要求: WS.url("https://maps.googleapis.com/maps/api/directions/json") .withQueryString( "origin" -> Seq(oLa, oLn).mkString(","), "destination" -> Seq(dLa.toString, dLn.toString).mkString(","), "sensor" -> "false", "key"
WS.url("https://maps.googleapis.com/maps/api/directions/json")
.withQueryString(
"origin" -> Seq(oLa, oLn).mkString(","),
"destination" -> Seq(dLa.toString, dLn.toString).mkString(","),
"sensor" -> "false",
"key" -> "IzaSyBAFWRgLWNKIEB2xCdm11ilCfzyVxJ2dasNw"
).get
我想查看“原始”URL+查询字符串
本文建议使用wireshark:
碰巧我在SSL下…不确定您所说的“原始URL”到底是什么意思。你是说:
val u = WS.url("https://maps.googleapis.com/maps/api/directions/json")
.withQueryString(
"origin" -> Seq(oLa, oLn).mkString(","),
"destination" -> Seq(dLa.toString, dLn.toString).mkString(","),
"sensor" -> "false",
"key" -> "IzaSyBAFWRgLWNKIEB2xCdm11ilCfzyVxJ2dasNw"
)
println(u.toString)
u.get
这是一种方式:
import play.api.libs.ws.ahc.AhcWSRequest
val ahcRequest = req.asInstanceOf[AhcWSRequest].buildRequest()
Logger.debug("Uri: " + ahcRequest.getUri)
播放2.6的更新:
import play.api.libs.ws.ahc.AhcWSRequest
val ahcRequest = req.asInstanceOf[AhcWSRequest]
Logger.debug("Uri: " + ahcRequest.uri)