想学习构建一个简单的java rest服务器 [英] Want to learn to build a simple java rest server
问题描述
世界各地的人们!
我是Android开发人员,到目前为止我只在客户端工作过。我的下一个项目是需要服务器进行通信,我想尝试自己构建它。
I'm an Android developer and so far I've worked only on the client side. My next project is in need of a server to communicate with and I wanna try to build it myself.
有人可以指导我学习如何构建一个漂亮,小巧,简单的Java restful服务器吗?
Can someone give me direction to a good source of learning how to build a nice, small and simple Java restful server?
我环顾四周,那里有太多的信息,而且令人困惑。也许你们当中有一个人已经知道并且知道一个很好的资料来源吗?
I've looked around, there is way too much info out there and it's confusing. Maybe one of you was in my shoes already and know a good source for it?
推荐答案
首先你应该阅读并学习如何使用Jersey.This是JAX-RS API(REST for Java)的最佳实现
https:// jersey .java.net /
然后你需要一个好的HTTP服务器和Java Servlet容器。我建议你使用Jetty http://www.eclipse.org/jetty/
这里有很好的教程:
At first you should read and learn how to use Jersey.This is the best implementation of JAX-RS API (REST for Java) https://jersey.java.net/ Then you will need a good HTTP server and Java Servlet container.I advice you to use Jetty http://www.eclipse.org/jetty/ Here good tutorials:
- http:// crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/
http://www.vogella.com/tutorials/REST/article.html
- http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/ http://www.vogella.com/tutorials/REST/article.html
你说简单的服务器,但如果你想要高性能那么阅读本教程
http://www.javarants.com/2008/12/27/using-jax-rs-with-protocol-buffers-for-high-performance-rest-apis/ 和使用Grizzly容器代替Jetty: https://grizzly.java.net/
You said "simple server" but if you want high performance then read this tutorial http://www.javarants.com/2008/12/27/using-jax-rs-with-protocol-buffers-for-high-performance-rest-apis/ and use Grizzly container instead of Jetty: https://grizzly.java.net/
这篇关于想学习构建一个简单的java rest服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!