Hi

I think this is what Brad has hit earlier. Typically selection between 
otherwise similar methods is driven by the number of
discriminators, such as produce/consume mime types, etc, but in this case all 
of them but the path values match. As a result of the
feedback based on the Brad's example, the JAX-RS specification will update the 
way path expressions are converted into regular ones.
The latest code on the trunk fixes this issue using a temporarily workaround 
(precedence based on a number of matching groups).

@GET
@Path(value="/order", limited=true)
public List<Order> getOrders() {
....
}

I hope the NPE will go away too on the latest trunk. The issue here is that no 
out-of the box providers support the serialization of
collections such as List. The updated JAXB Provider will check for the 
ObjectFactory if any available in Order's java package (I
think I was able to get to the generic type of response element at runtime...) 
- perhaps you can use JAXBElements in that factory or
indeed you can use JAXBElement in your signature if it's acceptable.
JAXBProvider also checks for @XmlJavaTypeAdapter on a method for marshalling 
only - this is another thing you can try - at some
stage such adapters will probably  get created automatically...

Cheers, Sergey

Hi all,

I have a seemingly simple JAX-RS question, but, for some reason, I  cannot 
figure it out.

Assume a simple REST order service.

GET /order should return a list of all current orders, while
GET /order/{id} should return the details of the order with the id {id}.

How would I annotate this in JAX-RS / CXF? My simple approach

<snip>

@Path("/")
public class OrderService {

@GET
@Path(value="/order", limited=true)
public List<Order> getOrders() {
....
}

@GET
@Path(value="/order/{id}", limited=true)
public Order getOrder(@PathParam("id") String id) {
....
}

}

</snip>

does not seem to work, because the mapping '/order/{id}' seems to  match both 
request types from above (and I get a NPE for GET
/order).  Why is this the case? To me this behavior seems counter-intuitive,  since 
intuitively @Path(value="/order") seems like a
'better' match  for GET /order than @Path(value="/order/{id}") ...

Can somebody please shed a light on this?

/philipp

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to