rest接口

javawanglei 2016-05-06 06:00:11
谁有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;
}


}













...全文
152 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧