Hi Tran,

Normally, you would attach an application to a VirtualHost, but if you need
to use a regular Router, you should change its default matching mode to
Template.MODE_STARTS_WITH.

Best regards,
Jerome
--
http://www.restlet.org
http://twitter.com/#!/jlouvel



-----Message d'origine-----
De : rastakiki [mailto:[email protected]] 
Envoyé : jeudi 8 septembre 2011 12:28
À : [email protected]
Objet : How to add an application to a router with restlet 2.0.1

Hi,

I would like to have a url like:

http://localhost:8080/tata/toto

i would like to do that with an existing application and a router:

Router router = new Router(getContext()); router.attach("/tata", new
Application() {
            @Override public Restlet createInboundRoot() {
                final Router router2 = new Router(getContext());
                router2.attach("/toto", TOTOResource.class);
                return router2;
            }
        });

But it is not working.

It only works when i add a router to a router:

Router router = new Router(getContext()); Router router2 = new
Router(router.getContext()); router2.attach("toto", TOTOResource.class);
router.attach("/tata", routeur2);

Could you please help me?

Thanks and regards

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

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

Reply via email to