RE: JSR311: The best practice to return primitive types from a RESTful service?

From: Liu, Jervis <>
Date: Wed, 5 Dec 2007 04:48:44 -0500

> -----Original Message-----
> From: Roy T. Fielding [] On Behalf Of Roy T. Fielding
> Sent: 2007125 4:06
> To:
> Subject: Re: JSR311: The best practice to return primitive types from a
> RESTful service?
> On Dec 4, 2007, at 2:00 AM, Liu, Jervis wrote:
> > I think we do need to support " int someMethod ()", this make it a
> > lot easier when people migrating their existing code to JSR-311.
> > For example, I may have following method in my POJO, it is just a
> > matter of adding extra JSR-311 annotations then I can expose this
> > POJO as a RESTful service.
> >
> > int getEmployeeAge(String employeeName) {
> > ...
> > }
> No, that would be encouraging folks to migrate one crappy design
> to another -- it has nothing to do with being RESTful. There is no
> way to "migrate" a POJO design to a RESTful design without completely
> redesigning the service. That is, in fact, the entire point -- design
> the service so that it matches the reality of network-based applications
> instead of doing RPC in yet another inefficient syntax.
> ....Roy

Hi Roy, do agree with you that such a design should be not encouraged, it takes time for folks (including myself) from a service-oriented world to think in a resource-oriented way, the spec API should enforce people doing the right way whenever it is possible. However I am not convinced yet that the spec API should prohibit one doing " int someMethod ()" (though we can put a caution in the spec to say this is not a recommended practice). I can always argue "int" itself can be made as a resource, can't I? The spec just needs to make this possibility open to one who has to do this in some edge cases...

> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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