Hi Luis,

This is due to the fact that directory listing isn't possible with the
war:// client connector, as opposed to the file:// client.

However, could you try this:

      // expose static API docs
      Directory docsDir = new Directory(getContext(), "war:///doc");
        docsDir.setNegotiateContent(false);
        docsDir.setIndexName("index.html");
      router.attach("/doc/", docsDir);

Let us know if this doesn't solve your issue and we'll look at the code.

Best regards,
Jérôme Louvel

PS: No problem for the HTML mail, I think most people can read them fine.
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 8 octobre 2008 01:25
À : [email protected]
Objet : serving static files from servlet WAR with Directory class:
index.html not served automatically

(Apologies for my previous non-text email; trying again.)

I’m using restlet 1.1-RC2 with the ServerServlet extension on Oracle AS
10.1.3 with the web.xml configuration method.

I was able to successfully serve static files (included in the
'webapp/doc' directory within the WAR) using an instance of the Directory
class, as follows:

      // expose static API docs
      Directory docsDir = new Directory(getContext(), "war:///doc");
      router.attach("/doc/", docsDir);

My problem, however, is that the 'index.html' file within the 'webapp/doc'
folder is not served automatically by the NRE when I use the following URL
(instead the server returns 404):

      http://abc.com/mywar/doc

But it does work when I use the following explicit URL:

      http://abc.com/mywar/doc/index.html

Is there a configuration that needs to be set so that the Directory class
will return the index file when a parent URL is accessed? Using log
output, I have verified that Directory.getIndexName() does in fact return
"index".

Does anyone have a solution? Thanks,

    - Lu

Reply via email to