使用 Jersey(JAX-RS)、mySQL 和 Eclipse 开发 Java Web 服务

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6964227/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:46:57  来源:igfitidea点击:

Developing a Java web service using Jersey(JAX-RS), mySQL and Eclipse

mysqleclipseweb-servicesjakarta-eejersey

提问by user598789

I have successfully created Web Services from MySQL Database using Netbeans tutorial. However, I would like to develop similar web services using Eclipse IDE. Why Eclipse IDE? There are two reasons for that:

我已经使用Netbeans 教程从 MySQL 数据库成功创建了 Web 服务。但是,我想使用 Eclipse IDE 开发类似的 Web 服务。为什么是 Eclipse IDE?有两个原因:

1) This is because i am using Tomcat 7.0 and JEE6. Unfortunately, NetBeans 7.0.1 implements Facade design pattern while using their “Create Web services from Database …” Wizard and it does not have a plugin for Tomcat 7 and EE6.

1) 这是因为我使用的是 Tomcat 7.0 和 JEE6。不幸的是,NetBeans 7.0.1 在使用他们的“从数据库创建 Web 服务……”向导时实现了 Facade 设计模式,并且它没有用于 Tomcat 7 和 EE6 的插件。

2) The NetBeans Wizard is helpful but does not help me understand details about using JDBC bridge, managing connections to MySQL DB and creating services to access the DB. Additionally, i want to add authorization for my services so that only registered users will be able to access my web services.

2) NetBeans 向导很有帮助,但不能帮助我了解有关使用 JDBC 桥、管理与 MySQL DB 的连接以及创建访问 DB 的服务的详细信息。此外,我想为我的服务添加授权,以便只有注册用户才能访问我的 Web 服务。

采纳答案by Ryan Stewart

There's a very clear tutorialfor building JAX-RS services in the Jersey user guide.

Jersey 用户指南中有一个非常清晰的构建 JAX-RS 服务的教程。

回答by VSarin

I found this tutorial that contains Restful web services using java and mysql in eclipse. It might be what you were looking for though it is a very simple tutorial. Check it out. http://www.techpages.org/webservice/simple-restful-web-services-using-java-and-mysql-example/2009/

我发现本教程包含在 Eclipse 中使用 java 和 mysql 的 Restful Web 服务。尽管它是一个非常简单的教程,但它可能正是您正在寻找的。一探究竟。 http://www.techpages.org/webservice/simple-restful-web-services-using-java-and-mysql-example/2009/