Search code examples
restlet

Restlet: use "index.html" as default for serving static content using CLAP protocol


I want to put static content in my restlet based web service. The static part must reside into the jar of the service. The code I'm using is:

Directory directory = new Directory(getContext(), "clap://class/pageData"); router.attach("/page", directory);

If I access the service with .../page/index.html the page is displayed in the browser. But the call of .../page or .../page/ results in a "Not found" error page.

How can I make index.html the default file?


Solution

  • You should try to specify implicitely the indexName property on your directory:

    Directory directory = new Directory(
         getContext(), "clap://class/pageData");
    directory.setIndexName("index.html");
    router.attach("/page", directory);
    

    It seems that the default value is index and not index.html...

    Hope it helps you, Thierry