views:

5389

answers:

9

OK - Im getting really piss3d off here!!! 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!

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 Tutorial Comments

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. We had difficulty working out that the jars had to be in copied into the correct lib folder.

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

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

, the tutorial says:

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

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:

original:

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

should be:

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


Conclusion

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.

+3  A: 

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.

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.

Greg Hines
Funnily enough I have just ordered RESTful Web Services on Amazon before I read your post. Thanks for your valuable comments too.
Vidar
+6  A: 

Hi Simon,

Could you describe precisely what caused you troubles in our Restlet tutorials? We are interested in fixing/improving what needs to.

Did you check the screencasts? http://www.restlet.org/documentation/1.1/screencast/

Otherwise, there is a Restlet tutorial in the O'Reilly book that we wrote in their Chapter 12.

If you still have troubles, please contact our mailing list: http://www.restlet.org/community/lists

Best regards, Jérôme Louvel

Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com

Jerome Louvel
Please see my new edits in my question - cheers.
Vidar
+1  A: 

Hello Simon,

you point to an error inside the web.xml, but I've just checked in both Restlet 1.0 and 1.1 documentation, and I don't see this kind of error. I would like to mention that you can find at the end of the page a zip that contains a complete war file and the list of source files in case you want to run in "standalone" mode. Did you try the standalone mode? As explained in the tuto, you only need 2 jars in the classpath, and the source files.

We would like also to point that the "firstSteps" tutorial is not a tutorial on REST but on the programmation with Restlet. You can also have a look at the "firstResource" tutorial (http://www.restlet.org/documentation/1.1/firstResource) which describes how to develop a simple resource and which introduces some concepts of the REST architecture style. It should help you.

Best regards, Thierry Boileau

A: 

Not specifically Java-related, but I thought these InfoQ articles were quite good:

Dan Dyer
A: 

In addition, the qualified named suggested in the tutorial is indeed "firstStepsServlet.FirstStepsApplication" and not "com.firstStepsServlet.FirstStepsApplication".

Therefore, the suggested param value in web.xml is correct.

Could you confirm that this fixes your issue? Also, did you have Servlet deployment knowledge before reading the tutorial? If not, that would explain the pain. In this case, the standalone mode is probably a better fit.

Jerome Louvel
See my new edits in my post
Vidar
We fixed the typo. Note that in addition to the firstSteps and firstResource pages supposed to get you started quickly, there is a more detailled Tutorial that will walk you through the various concepts of REST and Restlet:http://www.restlet.org/documentation/1.1/tutorial
Jerome Louvel
A: 

Hello Simon,

thanks for your report. I've updated the tutorial text and removed the reference to "com.first..." which was obviously a mistake.

best regards, Thierry Boileau

A: 

eSoftHead company has just released a short tutorial of developing Restful application by using RESTeasy. You could read the post at http://blog.esofthead.com/develop-restful-application-with-resteasy/

Nguyen Phuc Hai
A: 

I agree with the original post. The Restlet tutorial is nothing but frustration. Here is an example of Part03 in Restlet-1.1. It's supposed to start an internal HTTP server on port 8182 (Jetty is my guess). First there is no indication what jars have to added to the runtime classpath. When I added org.restlet.jar; com.noelios.restlet.jar;com.noelios.restlet.ext.net.jar, and I am running the main() I see: [java] INFO: Starting the internal HTTP server

Nevertheless, running the browser with http://localhost%3A8182/ gives Firefox can't establish a connection to the server at localhost:8182.

I tried to add the following Jetty related jars to runtime classpath com.noelios.restlet.ext.jetty_6.1.jar; jetty-util-6.1.20.jar; jetty-ajp-6.1.20.jar, but this time I got runtime errors: [java] SEVERE: Unable to register the helper com.noelios.restlet.ext.jetty. AjpServerHelper [java] java.lang.reflect.InvocationTargetException [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native ------------------

I may be doing something wrong but can anyone from Restlet team indicate how it's supposed to be run.

Vitaly