Hello Rhett,

Thanks for the reply!

What I would like to do is to create many "application" class instances at 
runtime through some internal trigger...which can be done using:

attach(String pathTemplate, Restlet target)

and to delete I use:

detach(Restlet target)

no problem here.

but for resource class instances I can only route "applications" to them using:

attach(String pathTemplate, Class<?> targetClass) 

Meaning, I would have to use the same resource class instance for all the 
"applications" that route to it. Although what I want to do is to have 
different "resource" instances that differ in how they are initialized.

I hope I have illustrated this properly.

Many thanks,
Tariq

> Hi Tariq,
> 
> On Feb 26, 2010, at 5:33 AM, [email protected] wrote:
> 
> > I would like to know why instances of "resource" classes cannot be  
> > dynamically created at runtime like the "application" class.
> 
> Resources _are_ instantiated dynamically at runtime -- one instance  
> per request (assuming that the request gets routed to a Resource).   
> The Restlet which handles this instantiation is is the Finder.  You  
> can use a custom Router subclass to use a different Finder  
> implementation if the default behavior doesn't work for you.
> 
> Can you give an example of what you're trying to do?
> 
> Rhett
> 
> > The idea is that I would like to initialize the resource class  
> > instance depending on different data that is acquired during  
> > runtime, and hence handle interactions differently.
> >
> > An alternative to this is to just handle the requests at the  
> > "application" without the use of the resource class. But I would  
> > like to use the resource class so that I could automatically  
> > generate WADLs using the respective extension class(es).
> >
> > Many thanks,
> > Tariq
> >
> > ------------------------------------------------------
> > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2452502

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

Reply via email to