I'm using restlet 1.1-RC2 with the ServerServlet extension on Oracle AS
10.1.3 with the web.xml configuration method, as follows:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Restful Web Service</display-name>
<!-- Application class name -->
<context-param>
<param-name>org.restlet.application</param-name>
<param-value>com.abc.RestfulApplication</param-value>
</context-param>
<!-- Restlet adapter -->
<servlet>
<servlet-name>RestletServlet</servlet-name>
<servlet-class>com.noelios.restlet.ext.servlet.ServerServlet</servlet-class>
</servlet>
<!-- Handle all requests -->
<servlet-mapping>
<servlet-name>RestletServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
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".
Thanks,
- Lu