Want to learn to build a simple java rest server [closed]

放肆的年华 提交于 2019-12-02 18:41:06
Oleksandr Karaberov

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:

  1. http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/ http://www.vogella.com/tutorials/REST/article.html

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/

Mena

If you intend to build a simple server with sockets, you could try:

  • this SO thread for starters.
  • this interesting tutorial about sockets, and
  • the official Oracle page about sockets.

Edit this doesn't cover the "restful" side of your question though.

I just went trough this myself creating a Java server with Android client. And this two links provided plenty of info! a tip is to search for Java Socket server.

to learn JavaSocket I use http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html And to pull it all togheter with Android client and ServerSide.

http://myandroidsolutions.blogspot.se/2012/07/android-tcp-connection-tutorial.html

Don't forgett to open ports in ur firewall to get the communication to work! to add Internet support in ur Android Manifest!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!