Hi Troy,

Were you able to solve this? Maybe you need a trailing slash when you attach
the directory:

        router.attach("/images/", d);

There is a working sample in the tutorial in case you need it:
http://www.restlet.org/documentation/2.0/tutorial#part06

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


-----Message d'origine-----
De : troy [mailto:[email protected]] 
Envoyé : lundi 31 août 2009 17:00
À : [email protected]
Objet : missing something stupid with static files

I have some Resources working, but I can't seem to get a static
Directory working.  Does this look right?

public class ControlApp extends Application
{
    @Override
    public synchronized Restlet createRoot()
    {
        Router router = new Router(getContext());

        // resource routes work
        router.attach("/user/{login}/foo", FooResource.class);
        router.attach("/user/{login}/foo/{fooID}", FooResource.class);

        // static files do not work
        String ROOT_URI = "file:///tmp/";
        Directory d = new Directory(getContext(), ROOT_URI);
        d.setListingAllowed(true);
        d.setDeeplyAccessible(true);
        router.attach("/images", d);

        return router;
    }
}


Yes, I added the FILE protocol to the component.

      component.getServers().add(Protocol.HTTP, 8182);
      component.getClients().add(Protocol.FILE);


Thanks,
tlc

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

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

Reply via email to