Search |
||
Annotating the JAX-RS 1.0 Spec: Chapters 1 and 2Posted by joconner on October 20, 2008 at 1:10 AM PDT
I spent part of the weekend reading the JAX-RS 1.0 Specification. With a wife, 5 kids, a dog, and a needy mother-in-law, I'm pretty busy. AYSO soccer, youth football games, and family outings take most of weekend time, but Sunday nights are my time. Ahh, time to relax you might think. But no...I spent most of the time reading a technical spec. I recently hinted that I was beginning to explore RESTful web services, and I'm planning to write a full-length introductory article on the topic soon. Before I go that far, I thought I might share some of my questions and comments (my annotations) of the JAX-RS 1.0 Spec. Like a good novel, the spec deserves to be read from beginning to end. Let's start at chapter 1. OK, I'm kidding about the good novel part, but still, you should probably start at the beginning. Chapter 1 is the intro. What did I get from it? Well, it is an introduction after all. That means that it's not particularly heavy on details, but it does set your expectations for what the spec will define. The specification defines the Java APIs that allow you to create web services based on Representational State Transfer (REST) architecture. What's REST architecture? You can do a lot of reading to finally figure this out. In a very, very small nutshell...REST designs for web services define resources exposed as URIs. You operate on those resources using the basic HTTP vocabulary of GET, PUT, POST, DELETE, maybe a couple other HTTP actions. To be REST based, a web service must expose resources as URIs and allow applications to access those APIs through the standard HTTP actions. Actions and methods do not go into the URI path or query string. Goals. The spec wastes no time letting you know just what its intentions are. You have to have goals, so here they are:
Non-Goals. I always get a kick out of "non-goals". This is the section that tells you what the spec will not specify. I dunno. That's funny to me. I suppose its a way of letting readers know right away that certain subjects won't show up later in the specification. And if you wonder whether a missed subject is an oversight, you can always check the "non-goals" section. I guess if the missed subject is in the non-goals section, you can be sure that the subject was considered but left out intentionally. If something is not specified entirely and is not in the non-goals section, can we assume that point is an unintended oversight?
Terms. My only complaint about the terms section is that it immediately references later parts of the spec. Ugh. Forward references to material I haven't read yet doesn't help me much at this point.
Whew...that's it for chapter 1. We had some goals, non-goals, and some terms. And well, I'd say I'd rate the sections in this same order. The goals section is the most informative, the non-goals is helpful I suppose to know just what will NOT be described, and the terms are just frustrating. The frustration comes from the referal to later sections. I suppose that can't be helped, but it's still frustrating from a newbie perspective. Chapter 2 is about applications...supposedly. At two pages long...really just one after you throw out the headings...this chapter doesn't contain much. Here's what you'll get from chapter 2 (Applications):
And that's it for chapter 2...really. Have you read the spec. If so, do you have any notes that clarify or help us understand either of these first two chapters? »
Related Topics >>
Java Web Services and XML Comments
Comments are listed in date ascending order (oldest first)
Submitted by mhvenkat on Tue, 2009-05-05 14:13.
The "sub-resource locator" method in the resource class is basically implementing subresource polymorphism.
If there are two subresourcee implementing a subresource interface, then in the locator method, based on some criteria the locator method will create the instance of the correct subresource.
See http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-Selectingbetweenmult... for a detail writeup.
We can avoid developing this handler method for subresources by using Guice or Spring auto-wired injection.
|
||
|
|