您好,有以下routes文件:
POST /user/:id controllers.Application.updateUser(id: Long)
有没有一种简单的方法可以从中获取价值Http.Context?context.request().queryString()总是空的。
您好,有以下routes文件:
POST /user/:id controllers.Application.updateUser(id: Long)
有没有一种简单的方法可以从中获取价值Http.Context?context.request().queryString()总是空的。
context.request().queryString()仅返回查询字符串参数,而您将 放在id路径中。如果你想得到它,你必须自己把它从路径中提取出来,例如:
long id = Long.parseLong(context.request().uri().substring(
context.request().uri().lastIndexOf('/') + 1));
context.request()._underlyingRequest().getQueryString(<ID>)