我正在使用java的post man客户端。我想使用邮递员在hadoop中测试文件是否存在。
这是我的计划:
String arguments = "hdfs://nameservice1/user/ec2-user/" + bedroom + "-" + bathroom + "-" + area + "-" + city + "/part00000";
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("http://ec2-52-34-14-38.us-west-2.compute.amazonaws.com:14000/webhdfs/v1/user/ec2-user/" + bedroom + "-" + bathroom + "-" + area + "-" + city + "/part-00000?user.name=ec2-user&op=OPEN")
.build();
if (request.equals(arguments)) {
com.squareup.okhttp.Response responses = null;
responses = client.newCall(request).execute();
System.out.println(responses);
String output = "Prediction Value is " + responses.body().string();
return Response.status(200).entity(output).build();
} else {
oozie objOz = new oozie(bedroom, bathroom, area, city);
String response = objOz.callOozie();
System.out.print("The Predicted Value is :" + response);
com.squareup.okhttp.Response responses = null;
responses = client.newCall(request).execute();
System.out.println(responses);
String output = "Prediction Value is " + responses.body().string();
return Response.status(200).entity(output).build();
}
if else部分不起作用。