Merry Christmas and sorry for not posting in a few days. I was trying to meet the deadline for getting the updates for my book to the publisher and Geoff and I had to pull a couple of all nighters. The title of the book is Persistence in the Enterprise and it should be released soon. I also just published an article on using the EJB 3 FP for WebSphere.
I wanted to post on this a few days back. In the first installment of my Project Zero Series (Part 2 based on Milestone 3 will be released shortly) we discuss RESTful patterns. One of the things that we covered is RESful patterns for getting a list of all items and a single record.
* http://host/resources/customer will return a list of customers.* http://host/resources/customer/roland will return the record for Roland.
One thing I have been getting asked is how do I RESTfully interact with a partial list. Not pagination of a list, but specifically asking for a list based on a set of keys. This is equivalent toselect * from table where key in (a,b,c,d,e). The most typical use case for this feature I have seen is a "Compare" feature in a shopping application, where I may select 3 or 4 items to compare side by side. By selecting a checkbox and clicking compare, I need to generate a RESTful URI with 3-4 keys. One thing to note that REST allows the use of query parameters as an alternative.
http://host/resources/customer/roland and http://host/resources/customer&customerId=Roland are both perfectly RESTful. I know that some people prefer not to use query parameters this way to access a single record. The rule of thumb I have heard is use the URI namespace for primary keys or other mandatory fields, and query parameters for filter criteria or optional parameters. With that in mind, there are three options for this RESTful query
Option 1: Namespace Option.
In this case, you add a set of keys after the product. This may require you to do some parsing of the URI, and it can be confusing if keys are Strings, because nested URI names can also imply relationships such as /category/3/product
Option 2: Multiple Query parameters for key
Most servers will give you an array back.
Option 3: Single comma separated key parameter.
This one seems more compact and straight forward, but again you have to parse yourself. However, if your service implementation is using a Select * from Product where productId IN(23,24,244,33), then you can pass this request parameter fairly simply into the In clause. Although with some implementations, building queries this way may by pass prepared statements.
MobileFirst, API's, and PaaS - Field Perspective
From archive: December 2007 X
Milestone 3 of Project Zero has been released. As posted on the Project Zero Developer's Blog, some major highlight's include:
I will be presenting at AjaxWorld in NYC, in the month of March, about Project Zero.
Also, I recently released an article that shows you how to use the EJB 3 Feature Pack for WebSphere.[Read More]
Below is a summary of the supported actions:
Jason McGee recently put out 3 videos on YouTube for Project Zero.
Installing Project Zero on Eclipse.Project Zero - Hello World on Eclipse.Installing Project Zero CLI (Command Line Interface)
In addition, if you would like to get a hands on tutorial, Steve Ims and I put out a tutorial back in October based on the M1 driver called Introduction to Project Zero: Part 1 - Building RESTful Services with Project Zero.
Part 2 of this series is going to be released in January, probably based on M3.
There are a few other articles out there as well:
Use Active Content Filtering for Project Zero application securityPreserve the security of your Project Zero applications, Part 1: Authentication and authorizationGet started with Project Zero and PHPOptimize database configuration and dependencies of Project Zero applicationsCreate a photo album application with Project Zero and REST design principlesAdd other scripting languages to your Project Zero applications
The Project Zero website itself has a few movies, samples, and tutorials worth checking out. There is a very comprehensive Developer's Guide as well.[Read More]
rbarcia 1000005FXD 2,055 Views
The WebSphere EJB 3 Feature Pack has GA'ed.
You can download it for free and install it on WAS 6.1.
You may also want to use the Web 2.0 FP as a way to expose your EJB 3 based solutions to Web 2.0 platforms like Project Zero. The Web 2.0 FP provides API's for exposing Enterprise Components via JSON, XML, or Atom. In addition, the Ajax Proxy component of the Feature Pack can help Dojo Applications invoke other services without worrying about the cross-domain issue.
The EJB 3 FP + the Web 2.0 FP I believe gives you a nice programming model for exposing some of your Enterprise Components via JSON based services. Below is an example of an Enterprise Application Model. I have seen more and more departmental apps (usually written in something like PHP or Ruby) need to access Enterprise Services. Project Zero makes it easy to invoke HTTP based services and build quick websites with REST Based Services, Dojo, Zero Resource Modeling, Rich client eventing and feed/rest assemblies. The main programming languages for Zero are Groovy and PHP.
Of course with Ajax Patterns, you may have to think about how chatty you want to be between the browser and the server. These are general concerns for most Ajax applications when exposing data.[Read More]