users@jersey.java.net

[Jersey] ROA Conceptual Questions

From: Meeraj Kunnumpurath <mkunnumpurath_at_googlemail.com>
Date: Tue, 7 Jun 2011 00:53:06 +0100

Hi,

I have couple of ROA related questions, I would greatly appreciate someone
can shed some light on.

1. I have a URL that can be accessed by mutually exclusive paths. For
example, a client may search for all the employee by firstName some times
and lastName some other times. What would be the best way to model path
parameters on GET without introducing a hybrid RPC model, from a REST
perspective? for example. /employee/{firstName} and /employee/{lastName} are
indistinguishable from each other. Or would one use query parameters? Are
query parameters in general considered as an anti-pattern in ROA?

2. I have an order entry system where users add line items to an order.
First time a line item is added an order should be created, subsequent line
items are then added to the created order. Based on this I have a resource
for order and one for line item. My client is using GWT. The first tine a
line item is added I send a PUT on the order resource which returns an order
Id, followed by a PUT on the line item resource which quotes the order id.
Subsequent line item additions just do a PUT on the line item resource. Even
though this works well, the first interaction of a a PUT each on order and
line item result in two separate HTTP calls and hence are not
transactionally atomic. Is there a better way to model the resources?

Kind regards
Meeraj