Jerome Louvel <contact <at> noelios.com> writes: > ... > For the routing, this URI that matches the most number of characters wins in > the default routing mode (BEST_MATCH). For the directory, you can try > attachDefault(directory) instead of the "" URI. You can also play with the > routing modes and the order of the attachments (using the FIRST routing mode > for example). > ...
I guess I am ready to give up. All my attempts failed including suggested. Actually, just reading API without going through the source code I do not see how this issue (serving home resource for http://bobcat/ and serving a file for http://bobcat/file.html) can be solved. For example, something like this router.setRoutingMode(Router.FIRST); router.attach("/files", directory); router.attachDefault(directory); router.attach("/", HomeResource.class); will certainly be routed to the home resource for http://bobcat/file.html regardless of the default attach. I am wondering if the framework allows for dots '.' as a separator for the URI components. As far as I remember Rails does this - could be helpful here. Also, I searched this board - it looks like not long ago regular expressions could be used but not anymore. I also looked at the Variable - same way, I do not see how it can help here. What seemed to be an easy thing to do turned out to be not so easy. Should this functionality allow for more flexibility? Thanks, Serge > > > -----Message d'origine----- > > De : news [mailto:news <at> sea.gmane.org] De la part de serge > > Envoyé : dimanche 5 août 2007 01:34 > > À : discuss <at> restlet.tigris.org > > Objet : two quick questions > > > > 1. I was looking for a way to set routing to serve a dynamic > > content (home > > page) from the root (nothing is specified) and static files > > from the root if > > file name is specified. I found that this is working: > > > > Directory directory = new Directory(getContext(), > > Constants.STATIC_FILE_LOCATION); > > router.attach("/files", directory); > > router.attach("", directory); > > router.attach("/", HomeResource.class); > > > > I am wondering if the last two lines are a hack, or indeed > > that's how it's > > intended. I am also wondering how do you solve this "dilemma" > > on your site - > > obviously you did it since http://www.restlet.org/favicon.ico > > works correctly > > and http://www.restlet.org resolves as well. > > > > 2. Another question - is there an easy way to get > > HTTP_Referer value for a > > regular HTTP request? I am looking for an API similar to > > request.getClientInfo().getAgent() for user agent. > > > > Thanks, > > > > Serge > >

