本文介绍了我应该如何开始实施 RESTful Web 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的老板让我在我们的一些产品上实现 RESTful Web 服务.我们是一家初创公司,我是唯一被分配到此任务的人.

My boss asked me implement a RESTful web service on some of our products. We are a startup and I am the only one assigned to this task.

我对 Web 服务一无所知,更不用说 RESTful Web 服务.

I don't know anything about web service, not mentioning RESTful web service.

所以我想开始.

因为我不知道我们提供什么服务,所以我可以假设以下产品:

Because I can't tell what service we provide, I can assume this following product:

用户只需输入一个带有 x 和 y 参数的 url,我的服务就会返回 x*y 的结果.我认为这是一个非常基本的 RESTful Web 服务,对吗?请忽略详细信息,例如有多少用户将访问它.我可以假设很多用户都会使用我们的服务.

User just type a url with parameter of x and y, and my service returns the result of x*y. I presume this is a very basic RESTful web service, right? Please ignore details like how many users will access it. I can assume lots of users will have our service.

我如何开始以及我需要学习什么?

How do I start and what do I need to learn?

服务端要不要在前端设置一个Tomcat+一个RESTful托管软件?

Should I set up a Tomcat + a RESTful hosting software in front at server side?

请给我一些指导和提示.

Please give me some guidance and hints.

谢谢

我认为 Google Reader API/Facebook API/Twitter API 是我将要实现的 RESTful 服务的一个很好的例子.Google 和其他公司是如何实现这一目标的?

I think Google Reader API / Facebook API / Twitter API is a kind of good example for the RESTful service I am going to implement. How did Google and other company achieve that?

推荐答案

您没有指定语言,这会使其变得困难,但是有许多框架可以帮助您制作 RESTful 服务.

You didn't specify a language, which makes it tough, but there are many frameworks that could help you with making a RESTful service.

对于 Java,一个不错的选择是 Jersey (http://jersey.java.net/),既然你提到了 Tomcat,我假设你会使用 Java.

For java a nice one is Jersey (http://jersey.java.net/), and since you mention Tomcat I am assuming you will use Java.

按照教程,您将构建简单的服务,然后您可以开始添加更多的复杂性.

By following the tutorials you will build simple services and then you can start to add more complexity.

您可能想阅读以下内容:

You may want to read this:

http://ajaxpatterns.org/RESTful_Service

了解REST.

例如,什么时候使用GET、POST或PUT,以及当出现各种错误时应该使用什么响应代码.

For example, when to use GET, POST or PUT, for example, and what response codes you should use when there are various errors.

这篇关于我应该如何开始实施 RESTful Web 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 14:30