Matt,

You can use JAX-RS on top of Restlet, so you get similar functionality  
as Jersey but with the benefit of being able to write a Restlet for  
any unusual cases.

In terms of selecting different response formats you can use the  
accept HTTP header to allow users to specify the MIME type (e.g. text/ 
plain) and the Restlet or JAX-RS can do content negotiation. I think  
there is a way where the accept can be specified as a query string  
parameter for clients who can't set HTTP headers.

I'd personally avoid using a wrapper, if there is an error return a  
HTTP error response. For the terms of use add that to a WADL document  
describing the resources and then just include the body direct in the  
response.

Paul


On 22-Jan-09, at 10:02 AM, [email protected] wrote:

> Hi There
>
> This is more of a holistic ?? on restlet. I have been using it for  
> months and now we have a 'restful' project at work. I.e. our first  
> one. I am pushing hard for restlet but we also have some people who  
> want to try jersey or even write some layer on top of spring mvc or  
> look at struts 2...
>
> Here are my requirements.
>
> 1) All our responses will have some 'envelope' in terms of the  
> response data. I.e. if we serve xml all responses would have a  
> simliar format. e.g.
>
> <company>
>  <tos> TERM OF SERVICE FOR ALL RESPONSES </tos>
>  <error codes>
>      Here would be error codes like 'param not found'
>  <error codes>
> <response>
>   ....// concrete data here based on java object type....
> </response>
> </company>
>
> I did this quite easily by creating a 'template' resources that  
> handles a lot of the uniform plumbing (error catching, creating  
> response object) and subclassed with concrete resources that would  
> return the 'real data' via some template method. This worked lovely.  
> I also used spring which was great as I could have state in my  
> resources...
>
> Another desire is to parse the return type based on some uri param.  
> i.e.
>
> //mywsite/cars/123 -> return xml default
> //mywsite/cars/123?format=txt -> return txt if supported by  
> resource.. and NOT
> //mywsite/cars/123.xml
>
>
> Once again this shined with the great tunnel service.. I also used  
> jibx on my domain models and once again used the Jibx Representation  
> and it shined.
>
> The one down side my co-workers see is the lack of binding url  
> params to some kind of bean element (like Struts, spring mvc etc)  
> and that we would have to write our own.
>
> They are also curious about the 'scale' of restlet (if for example  
> as a stand alone app) and the number of concurrent requests we can  
> take at any given time. I will poke around at the code too see if i  
> can dig up anything.
>
> Anyways.. This was a long rant but if anybody has some thoughts  
> about how to convince my work to use RESTLET over others that would  
> be great.
>
> In advance, thanks.
>
> matt
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1043393

Paul Austin
President/CEO
Revolution Systems Inc.

+1 (604) 288-4304 x201
www.revolsys.com

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1043403

Reply via email to