rest接口
谁有rest本例 的例子 来一个
我写的 方法 报错 是、404 谁帮我 修改下 谢谢
写 在 两个 类中 启动之后 调用 下面的接口 然后 调用不到 这个谁帮我看下
public class app {
public static void main(String[] args) throws MalformedURLException, IOException {
URL url = null;
HttpURLConnection connet;
try {
url = new URL("http://10.203.1.245:8080/BizFep/PaperlessProcessor");
connet = (HttpURLConnection) url.openConnection();
System.out.print(connet.getResponseCode());
if(connet.getResponseCode() != 200){
throw new IOException(connet.getResponseMessage());
}
BufferedReader brd = new BufferedReader(new InputStreamReader(connet.getInputStream()));
System.out.println(brd.readLine());
connet.disconnect();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
@Path("customers")
class Interface {
@GET
public String getCustomers(){
return "getCustomers all";
}
@GET
@Path("{id}")
public String getCustomer(@PathParam("id") String uid) {
return "your id is "+ uid;
}
}