Hi John,

I suggest that each application has a distinct URI prefix to attach it to
the virtual host. Otherwise things will get complicated, especially when you
add more resources. 

component.getDefaultHost().attach("/main", new MainApplication()); 
component.getDefaultHost().attach("/stats", new StatsApplication()); ...

As an alternative, you could try something like:

component.getDefaultHost().attach("/stats", new StatsApplication()); ...
component.getDefaultHost().attach("/", new MainApplication());

Reusing the same Router instance in two separate applications isn't
recommended. Applications should be kept as isolated as possible from each
other (so they could be hosted in a separate JVM if necessary).

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Technical Lead ~ http://www.restlet.org
Noelios Technologies ~ http://www.noelios.com




-----Message d'origine-----
De : [email protected] [mailto:[email protected]] 
Envoyé : mercredi 3 février 2010 10:25
À : [email protected]
Objet : RE: Re: multiple application sharing the same basePath

Thanks for your quick answer.

As a workaround, can i share a same router instance among multiple
applications ?

The basic idea is to have multiple standalone applications that can interact
with the complete uri.

> Hello john,
> 
> I'm afraid this is not possible. Instances of VirtualHost and Router 
> classes (such as the component's default host) delegate requests to 
> handlers according to the current request's URI. Thus, your requirement 
> can't be addressed this way. Is it possible for you to have only 
> application?
> 
> Best regards,
> Thierry Boileau
> 
> > Hello,
> >
> > I am using Restlet 2.0
> > I am trying to associate two application to the default host with the
same URI pattern :
> >
> > getDefaultHost().attach("",new FirstApplication()));
> > getDefaultHost().attach("",new SecondApplication()));
> >
> > Each application return a Router in the overriden createInboundRoot
method.
> >
> > When i launch the server (using component.start()).
> > Only the first application is working. URIs from the second applications
are not matched ...
> >
> > How to have multiple application sharing the same basePath ?
> >
> > ------------------------------------------------------
> >
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24442
28
> >
> >

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

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

Reply via email to