Hi Alex,

Oh right! If you rely on client connectors, then you will need to set-up a
parent Component otherwise your context won't have a proper context's
dispatcher as required by the Directory class. So, it seems best to setup a
component with the client connectors, a virtual host and your application
instance attached to it. Note that the Component class is thread-safe and
not heavy at all, you can perfectly create multiple instances in the same
JVM.

Your unit test could then directly invoke the virtual host using its
"handle(Request, Response)" method. You just need to take care of properly
setting up your request' properties (hostRef, resourceRef and eventually
serverInfo).

The separation of concerns between the Component class (managing connectors,
virtual hosts and applications) and the Application class is important, it's
what allows for example the sharing of the same HTTP server between multiple
applications (virtual hosting).

Best regards,
Jerome  

> -----Message d'origine-----
> De : news [mailto:[EMAIL PROTECTED] De la part de Alex Combs
> Envoyé : jeudi 28 décembre 2006 19:39
> À : [email protected]
> Objet : Re: Testing Application problems
> 
> Hey Jerome,
> Unfortunately, this doesn't quite make the cut.  Right now 
> what I'm trying to do
> is to serve a static file with my Application.  According to 
> the tutorial,
> however (http://www.restlet.org/tutorial#part06) I basically 
> need a Component to
> set up the Protocol.FILE client connector.  Without it, any 
> gets that I call on
> the application will return 404 errors at best.  What would 
> be nice is if the
> Application itself could set up the connector, so I wouldn't 
> need the dummy
> Component.
> 
> 
> 
> 

Reply via email to