1
我有一个GET路线:playframework路由仅两次accessable在我playframework项目
GET /dashboard/issues @controllers.Dashboard.getBitBucketTickets()
的方法是这样的:
@Singleton
public Result getBitBucketTickets() {
String credentials = "J:Eb";
String encoded = DatatypeConverter.printBase64Binary(credentials.getBytes());
String json = null;
try {
json = new Gson().toJson(Unirest.get("https://api.bitbucket.org/1.0/repositories/t/frontend/issues?limit=5&status=new")
.header("Authorization", "Basic " + encoded)
.header("Content-Type", "application/json; charset=UTF-8")
.header("Accept", "application/json; charset=UTF-8").asJson());
} catch (UnirestException e) {
System.out.println(e);
}
return ok(json);
}
当我调用路由两次我不能称它为第三次。我必须重新启动项目。
在这种情况下会出现什么问题?
感谢
好的,谢谢然后Ich明天会尝试 – Felix
当我这样做'WSRequest请求= ws.url(url).setHeader(“Authorization”,“Basic”+ encoded).get();' 我在setHeader中得到一个错误...函数setHeader()未知... – Felix
您需要在'build.sbt'文件中只添加一次'javaWs':'libraryDependencies ++ = Seq( javaWs ) ' –