Hi,
Just prepending a JAX-RS: prefix in the subject line.
Hi,
If I got a method like:
Customer getCustomer(@PathParam('cust') String custId) {
Customer c = myCustomerDao.getCustomer(custId);
if (c == null) {
// do something
}
return c;
}
Now, in the do something clause, I might want to respond with a http
code and maybe an errormessage. How do I inject those instead of just
returning null ?
You can throw a JAX-RS WebApplicationException or use JAX-RS ExceptionMappers and throw any exception you like (including the
RuntimeException), have a look at [1] please for more info :
Cheers, Sergey
[1] http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html
Kind regards,
Tarjei
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland