dominoGuru.com

Your Development & Design Resource

RESTful Java Web Services from Pack Publishing - Review and Giveaway!

RESTful 
Java Web Services from Pack Publishing REST theory and RESTful services, or REpresentational State Transfer, is a set of constraints that define a software architectural style. Simply put, it is a practice of leveraging HTTP Request Methods to interact with a data store. This approach greatly differs from simple CRUD - which we IBM Lotus Notes/Domino Web Application Developers are familiar. Where CRUD relies mostly on GET/POST Methods, RESTful Web Services leverage GET, POST, PUT, and DELETE to maintain remote data stores. REST, of course, sounds better than GPPD... but in summary that's pretty much it!

RESTful Java Web Services from Pack Publishing deep-dives into REST constraints, and applying that to Java Web Service Architectures in web application development.

You can read many different reviews of this book, but this review will be written with a mind for this site's target audience: IBM Lotus Notes/Domino Developers!

Chapter 1: RESTful Architectures

This chapter focuses on defining REST or RESTful architectures and their CRUD equivalent (table from Chapter 1):

Data Action HTTP Protocol Equivalent
Create POST
Retrieve GET
Update PUT
Delete DELETE

What I liked about this chapter is that it immediately began a deep-dive into the topic with very simple yet telling examples of each state of REST. Most books take the first chapter to give a history of the subject matter and save the meat of the content for Chapter 2. By the time we get to Chapter 2, we have not only covered that brief history, but we have a pretty decent understanding of REST and RESTful architectures via this chapter.

Chapter 2: Accessing RESTful Services - Part 1

I was happy to see that this chapter's for those of you following along at home example was the Twitter REST API. It's not some abstract service that exists solely for the purpose of this book; we know exactly what is expected when interacting with this micro-blog service, and thus can concentrate on and level-check our progress in learning about REST.

This chapter starts off by gearing you up. You're directed to the latest Java JDK, Jakarta's Commons HTTPClient, Commons Logging, and Commons Codec packages, Apache Tomcat, and Swing's Application Framework and SwingWorker.

For old-hand Java Developers, this should be a no-brainer. However, there really aren't many directions for setting up these downloadable wares. Of course, that's pretty out of scope for this book, but be forewarned that it can take some time to download and setup these applications.

The rest of the chapter discusses the Twitter API and interacting with the XML (either XML, JSON, RSS, or ATOM) and Servlets.

By the time you're done reading this chapter, you're either hooked or running away scared. Hopefully, you're ready for Part 2 ;-)

Chapter 3: Accessing RESTful Services - Part 2

With this chapter, you're going to be interacting with several different public web services: Google, Yahoo!, Twitter, and TextWise's SemanticHacker to create a localhost mashup using Prototype.

The chapter's build project, named the Semantic search mashup, is a pretty slick hello world v2.0 application... but while it's well documented in this chapter, I worry that it's a little too complex for non-Java developers.

Of course, if I was able to follow it, you should be able to as well...

And, as with most Pack Publishing titles, the pages of markup and code are available through download on the publisher's site -- really helps when you're dealing with a case-sensitive language and especially if you're unsure about what you're doing up to this point!

By the end of this chapter, you'll have a single application that will run queries against several public web services, consume the HTTP Request responses, and then parse and display the results. Sure, it's not too pretty, but it's functional! And it gives you an idea of the Retrieve capabilities of RESTful architectures.

Chapter 4: RESTful Web Services Design

This chapter's build project (if you will) is:

a social networking web application similar to Twitter.

Again, I get it: go with what you know, so you can focus on learning the technology versus trying to learn about project scope and overall function.

And don't worry, you're not diving that deep here - this chapter really talks to using URIs (via HTTP Method calls) to interact with data. At the end of the chapter, you should understand the action/reaction exchange with Web Services.

Chapter 5: Jersey: JAX-RS

Jersey is a pure Java RESTful framework that we're going to use to implement the web service that we created in Chapter 4.

There are several downloads needed for this chapter, some you may have; some you may not have already: Java JDK, Apache Tomcat, DB40, and (of course) the Jersey Framework.

This is a meaty chapter, and we get a lot from its 43 pages! We leave this chapter with a pretty solid grasp on RESTful Web Services with Jersey, and power through the JAX-RS API. Simple, but it builds quickly, and I think it's the example web service from Chapter 4 that lends to the ramp-up on the Jersey framework.

Chapter 6: The Restlet Framework

In this chapter - another meaty chapter (weighing in at 42 pages) - we review the two latest released versions of the Restlet framework... and we learn something pretty cool here: we're able to reuse the majority of the code created in Chapter 5. Of course there are tweaks required (and discussed in this chapter), but moving to another RESTful framework did not require a complete re-write.

You'll have basically the same downloads for this chapter, with the only difference being the framework download itself.

Chapter 7: RESTEasy: JAX-RS

You guessed it, another framework. More framework downloads, but this framework mentions an extended capability: RESTEasy is also JBoss's umbrella project that provides other frameworks to build RESTful web services.

The big perk here, JAX-RS to JAX-RS (Jersey to RESTEasy) means full reuse of the Chapter 5 code.

Chapter 8: Struts 2 and the REST Plugin

After downloading Struts 2, we dive into learning another framework. Since Struts 2 doesn't have native RESTful service support, we also discuss the REST plugin for Struts 2 which completes the Struts framework offering (as applicable to our Twitter-like web service from Chapter 4).

This is the last pure Java RESTful framework that we'll review in this book. The good news is that you have choices, and you have a book that gives you the pros and cons of selecting each.

Chapter 9: Restlet Clients and Servers

To quote this chapter...

In this chapter, the book covers the parts of the Restlet framework that we ddn't cover in Chapter 6, The Restlet Framework, because we specifically deployed our web service in a Java web container. However, the Restlet framework provides libraries to create standalone applications, includding RESTful clients and RESTful services.

At the end of this chapter, you'll be able to create Restlet clients and create and deploy RESTful Web Services that run as standalone Java applications that don't require a full-blown Java web server.

You get more out of this chapter (when combined with Chapter 6) then the last several chapters. Don't get me wrong, while framework introductions/reviews are useful... you finish Chapter 9 with more in your arsenal.

Chapter 10: Security and Performance

RESTful Java Web Services architecture considerations. How do we secure our web service now that we've built them, and how to we make sure we don't bring down production environments when those web services are called are the topics discussed in this chapter.

The book discusses various types of security options with even a few paragraphs on OAuth to give us even more options for authentication.

The Performance section of this chapter discusses hardware and networking architectures to ensure high availability of your web services (read: architect away from the FAILWHALE...). This chapter smartly cautions on premature optimization, understanding that your web service adopters will want to leverage 3rd-party clients, etc.

Conclusion

A solid entry in RESTful Web Services development that happens to use the Java language. You're given enough information on Web Services that you could easily port that knowledge to any technology platform. For example, Chapters 5-10 could just as well discussed IBM Lotus Notes Domino XPages and SSJS.

For someone who wants to leverage Java RESTful frameworks in their Web Service development, Chapters 5-9 are excellent overviews of 4 frameworks available to the web services developer. Better still, with the example service from Chapter 4 as your baseline, you get real world exposure to help you choose the best framework for you.

On the back cover of this book, we find the Who this book is written for:

This book is for developers who want to code RESTful web services using the Java technology stack together with any of the frameworks covered.

I would recommend this book to the following people:

  • Web Application Developers interested in learning about RESTful Web Services.
  • Web Application Developers interested in learning about several Java frameworks designed to work with RESTful Web Services.

I would not recommend this book to the following people:

  • Network Administrators or System Architects looking to support RESTful Web Services.
  • Lotus Notes Client (only) Application Developers

If you fall into that first category and not into the second, you can purchase RESTful Java Web Services directly from Packt Publishing in Adobe PDF eBook, standard Book, or both formats.

Review Copy Giveaway!

And -- as mentioned -- I am holding a contest where you can win my review copy of RESTful Java Web Services.

To enter, simply leave a comment on this post. with your name, email address (not published, but I'll need to contact you if you win...), and your thoughts on this review.

I will pick a winning comment at random by Friday, January 29th, 2010 9:00PM EST.

From there, I'll contact you for your mailing address and ship the book ASAP!

Good luck!


About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of dominoGuru.com, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.



More from dominoGuru.com


dominoGuru.com is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, dominoGuru.com by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.