Not at all, WebApplicationException is part of jsr-311 api...Returning null 
should work too it's just it's not supported...

Cheers, Sergey

----- Original Message ----- From: "scouredimage" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, May 15, 2008 5:52 PM
Subject: Re: JAX-RS Return type



Hi Sergey,

Thanks for the reply.

I will change my resource methods as you described. However isn't this
behavior of cxf deviating from the jax-rs specs?


Sergey Beryozkin wrote:

Hi

Try to do

   if(notFound) {
     throw new WebApplicationException(204);
  }

this way you can also add some more description to the response body
like "throw new
WebApplicationException(Response.status(204).entity(errorDescriptionObject).build());"


Hi All,

Looking at the JAX-RS 0.6 spec for Return Type (Section 2.2.2):
Other: Results in an entity body mapped from the return type. If the
return
value is not null a 200 status 26 code is used, a null return value results in a 204 status code.

This needs to be fixed...

Cheers, Sergey



However, I don't see this working on 2.1. Either that, or I am doing
something stupid.

@Path("/users/")
Public class UserService {
 @GET
 @Path("{id}")
 public User getUser(@PathParam("id") Integer id) {
   ...
   if(notFound) {
     return null;
   }
   return user;
 }
}

Any pointers?

Thanks in advance.
--
View this message in context:
http://www.nabble.com/JAX-RS-Return-type-tp17256757p17256757.html
Sent from the cxf-user mailing list archive at Nabble.com.

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



--
View this message in context: 
http://www.nabble.com/JAX-RS-Return-type-tp17256757p17257701.html
Sent from the cxf-user mailing list archive at Nabble.com.

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

Reply via email to