You've got warnings in your log that say you are missing the "file" protocol.

You should add it to your component's list of client protocols:

      getClients().add(Protocol.FILE);

Try that first.


On Fri, Dec 5, 2008 at 9:10 AM, Johnny Doe <[EMAIL PROTECTED]> wrote:
> I've read old messages here that dealt with serving up static pages using 
> Restlets, but none of the suggestions seem to work for me. I was wondering if 
> somebody could please take a look at my code and find what I'm doing wrong.
>
> I'm playing with the FirstResource application to also allow it to serve up 
> an index.html page. I'm deploying the application as a servlet using Tomcat. 
> Below is my code:
>
> Router router = new Router(getContext());
>
> String path = servletCtxt.getRealPath(".");
> int last = path.lastIndexOf(".");
> String appPath = "file:///" + path.substring(0, last).replace('\\', '/');
>
> Directory indexDir = new Directory(ctxt, new LocalReference(appPath));
>                indexDir.setIndexName("index.html");
>                indexDir.setDeeplyAccessible(true);
> router.attach("/", indexDir);
>
> // Defines a route for the resource "list of items"
> router.attach("/items", ItemsResource.class);
> // Defines a route for the resource "item"
> router.attach("/items/{itemName}", ItemResource.class);
>
> I'm continually getting a 404 error code. Below are the lines from Catalina's 
> log file
>
> Dec 5, 2008 11:09:38 AM com.noelios.restlet.component.ClientRouter getNext
> WARNING: The protocol used by this request is not declared in the list of 
> client connectors. (FILE)
> Dec 5, 2008 11:09:38 AM com.noelios.restlet.component.ClientRouter getNext
> WARNING: The protocol used by this request is not declared in the list of 
> client connectors. (FILE)
> Dec 5, 2008 11:09:38 AM com.noelios.restlet.LogFilter afterHandle
> INFO: 2008-12-05        11:09:38        127.0.0.1       -       127.0.0.1     
>   8080    GET     /RestletFirstResource/  -       404     330     -       31  
>     http://localhost:8080   Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
> rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4      -
> Dec 5, 2008 11:09:43 AM com.noelios.restlet.component.ClientRouter getNext
> WARNING: The protocol used by this request is not declared in the list of 
> client connectors. (FILE)
> Dec 5, 2008 11:09:43 AM com.noelios.restlet.component.ClientRouter getNext
> WARNING: The protocol used by this request is not declared in the list of 
> client connectors. (FILE)
> Dec 5, 2008 11:09:43 AM com.noelios.restlet.component.ClientRouter getNext
> WARNING: The protocol used by this request is not declared in the list of 
> client connectors. (FILE)
> Dec 5, 2008 11:09:43 AM com.noelios.restlet.LogFilter afterHandle
> INFO: 2008-12-05        11:09:43        127.0.0.1       -       127.0.0.1     
>   8080    GET     /RestletFirstResource/index.html        -       404     330 
>     -       16      http://localhost:8080   Mozilla/5.0 (Windows; U; Windows 
> NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4      -
>
> Any help is appreciated.
>
> Thanks.
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=980200
>

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

Reply via email to