RE: Re: Attaching a org.restlet.Directory to SpringRouter.

2009-01-22 Thread Ruben Hernando
Hello Santosh

you have to create a bean component, and use it to get the context


bean id=component class=
org.restlet.ext.spring.SpringComponent
property name=server ref=httpServer / 
property name=defaultTarget ref=root /
property name=client
util:constant static-field=
org.restlet.data.Protocol.FILE /
/property
/bean

Don't forget to add Protocol.FILE to make the Directory work.
Regards
Ruben




santoshkumar.baba...@gmail.com 
22/01/2009 07:34
Por favor, responda a
discuss discuss@restlet.tigris.org


Para
discuss@restlet.tigris.org
cc

Asunto
RE: Re: Attaching a org.restlet.Directory to SpringRouter.






I need the Context object to instantiate org.restlet.Directory(or its 
subclass). Since component in my case is a servlet container(tomcat 6), 
how/where do I get the context required for creating a directory? 

Below is how my config looks-
WEB.XML:
servlet
servlet-nametest/servlet-name
 
servlet-classcom.noelios.restlet.ext.spring.RestletFrameworkServlet/servlet-class
load-on-startup1/load-on-startup
init-param
   param-nametargetRestletBeanName/param-name
   param-valuerestletRouter/param-value
/init-param
   /servlet
 
 servlet-mapping
servlet-nametest/servlet-name
url-pattern/*/url-pattern
 /servlet-mapping

TEST-SERVLET.XML:
bean name=restletRouter 
 class=org.restlet.ext.spring.SpringRouter 
 property name=attachments 
 map 
 entry key=/users 
 bean class=org.restlet.ext.spring.SpringFinder 
 lookup-method name=createResource 
bean=usersResource/ 
 /bean 
 /entry 
  entry key=/users/{userID} 
 bean class=org.restlet.ext.spring.SpringFinder 
 lookup-method name=createResource 
bean=userResource/ 
 /bean 
 /entry 
 !- As suggested --
 entry key=/images value-ref=directory/
 /map 
 /property
 bean id=directory class=...SpringDirectory
property name=componentref 
local=component//property
/bean
/bean

In the code above, I do not to know to get the component object, since my 
component is a sevlet container. What can be done?

Another thought is just to let webserver handle the static file requests 
since it runs in tomcat. What you think?

Regards
Santosh

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

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

Re: maven snapshot

2009-01-22 Thread Thierry Boileau
Hello Daniel,

I finally have found some time to fix this. Could you have a look and 
test it?
best regards,
Thierry Boileau

 That's great, keep the latest snapshot file name to 
 artifict-version-SNAPSHOT.jar will save me 30 minutes each time I want to 
 try the latest snapshot. Thanks a lot.

 Best Regards,
 Daniel

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



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


Restlet vs other 'rest' frameworks questions/views

2009-01-22 Thread postmaster
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=4447dsMessageId=1043393


Re: Restlet vs other 'rest' frameworks questions/views

2009-01-22 Thread Paul Austin
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, postmas...@tigris.org 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=4447dsMessageId=1043393

Paul Austin
President/CEO
Revolution Systems Inc.

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

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