任何简单的Java REST教程? [英] Any easy REST tutorials for Java?

查看:103
本文介绍了任何简单的Java REST教程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

REST的每个教程或解释都过于复杂 - 在初步解释CRUD以及假定的简单性之后,学习曲线上升得如此之快。为什么人们不能再写出体面的教程了!

Every tutorial or explanation of REST just goes too complicated too quickly - the learning curve rises so fast after the initial explanation of CRUD and the supposed simplicity over SOAP. Why can't people write decent tutorials anymore!

我正在看Restlet - 它并不是最好的,教程中缺少一些东西和语言/语法有点令人困惑和不清楚。我花了几个小时来解开他们的第一步教程(在另一个Java程序员的帮助下!)

I'm looking at Restlet - and its not the best, there are things missing in the tutorial and the language/grammar is a bit confusing and unclear. It has took me hours to untangle their First Steps tutorial (with the help of another Java programmer!)

RESTlet教程评论

总的来说,我不确定该教程究竟是针对谁 - 因为全面存在相当程度的假设知识,所以进入REST和Restlet框架会让你感到很沮丧追赶工作要做,并一遍又一遍地重读段落。

Overall I'm not sure exactly who the tutorial was aimed at - because there is a fair degree of assumed knowledge all round, so coming into REST and Restlet framework cold leaves you with a lot of 'catchup work' to do, and re-reading paragraphs over and over again.


  1. 我们很难解决这个问题。 jars必须被复制到正确的lib文件夹中。

  1. We had difficulty working out that the jars had to be in copied into the correct lib folder.

创建HTTP状态500错误的web.xml问题 -

Problems with web.xml creating a HTTP Status 500 error -




服务器遇到内部
错误(),导致
无法履行此请求

The server encountered an internal error () that prevented it from fulfilling this request

,教程说:


像往常一样创建一个新的Servlet Web应用程序
,添加
com.firstStepsServlet包和
将资源和应用程序
类放入。

"Create a new Servlet Web application as usual, add a "com.firstStepsServlet" package and put the resource and application classes in."

这意味着您的类 FirstStepsApplication 的完全限定名称是 com.firstStepsServlet.FirstStepsApplication ,因此我们必须更改web.xml以引用正确的类例如:

This means that your fully qualified name for your class FirstStepsApplication is com.firstStepsServlet.FirstStepsApplication, so we had to alter web.xml to refer to the correct class e.g:

原始:

<param-value>
         firstStepsServlet.FirstStepsApplication
</param-value>

应为:

<param-value>
         com.firstStepsServlet.FirstStepsApplication
</param-value>






结论

我的印象是REST的概念应该比SOAP简单得多 - 但是如果不是更复杂的话,它似乎也差一点 - 根本没有得到它! grrrr

I was under the impression that the concepts of REST were supposed to be much simpler than SOAP - but it seems just as bad if not more complicated - don't get it at all! grrrr

任何好的链接 - 非常感谢。

Any good links - much appreciated.

推荐答案

听起来就像你可以充分理解REST的基本原理一样,为此我高度推荐 RESTful Web Services 。我对REST进行了很好的介绍:它是什么以及如何实现(实用的)RESTful Web服务。

It sounds like you could use a solid understanding of the fundamentals of REST, and for that I highly recommend RESTful Web Services by Leonard Richardson and Sam Ruby. I provides a great introduction to REST: what it is and how to implement a (practical) RESTful web service.

本书中的大多数示例代码实际上都是Ruby,但即使你不是Ruby专家也很容易理解。但有一件事应该对你有所帮助,本书后面的章节之一包含了几个RESTful框架的概述,包括Restlet。它并没有真正进入任何代码(这是一个50,000英尺的天桥),但我认为它会在这个阶段为您提供所需的代码。

Most of the example code in the book is actually Ruby, but it's easy enough to understand even if you're not a Ruby expert. But one thing that should help you specifically is that one of the later chapters of the book contains overviews of several RESTful frameworks, including Restlet. It doesn't really get into any code (it's a 50,000-foot flyover) but I think it'll give you just what you need at this stage.

这篇关于任何简单的Java REST教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆