ok no problem:

- localhost/MyApp/ -> returns index.html of the web content directory 

- localhost/MyApp/*relRef* -> MyResourceA (does something with the relative 
reference *relRef* and return a html representation)

- localhost/MyApp/restlet/* -> MyResourceB 
(returns a json representation)

best regards, robert

> Hi,
> 
> could you list the distinct URIs you want to define and their taret 
> (resource, static files, etc) ?
> 
> Best regards,
> Thierry Boileau
> 
> > I can't get this to work like I want:
> >
> > TemplateRoute route = router.attach( "/", MyResourceA.class );
> > route.setMatchingMode(Template.MODE_STARTS_WITH);
> > router.attachDefault(new Directory(getContext(), "war:///"));
> >
> > this always loads MyResourceA, because the main url ("localhost/MyApp/") 
> > also starts with a "/". But this should be attached to the war:/// 
> > directory instead of MyResourceA
> >
> > So I tried to attach MyResourceA as default and in this resource I evaluate 
> > the relative reference with getRequest().getResourceRef().getRelativeRef()
> >
> > But how can I forward to Directory(getContext(), "war:///") in case the 
> > relativeRef is "." ?
> >
> >
> >
> >    
> >> Hi,
> >>
> >> by default, the router matches the routes using the "equals" mode.
> >> In your case, you seem to need something which is more like "starts with":
> >>
> >> TemplateRoute route = router.attach( "/", MyResourceB.class );
> >> route.setMatchingMode(Template.MODE_STARTS_WITH);
> >>
> >>
> >>
> >> Best regards,
> >> Thierry Boileau
> >>
> >>      
> >>> thank you very much!
> >>>
> >>> I used your solution and it works good. But there is still a small 
> >>> problem:
> >>>
> >>> application class:
> >>>
> >>> router.attach( "/restlet/myresource",MyResourceA.class );
> >>> router.attach( "/*", MyResourceB.class );
> >>> router.attachDefault(new Directory(getContext(), "war:///"));
> >>>
> >>> I want to call MyResourceB when I type something like 
> >>> "localhost/MyRestletApp/requesturl" but this doesn't work. It always 
> >>> tries to convert the target to "war:///requesturl"
> >>>
> >>> What is wrong?
> >>> Thanks in advance!
> >>>
> >>>
> >>>        
> >

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

Reply via email to