Hi,

I just started experimenting with Restlet and could not get Directory to work on Tomcat 5.5 or Jetty 6.1. I always get 404 returned. I've tried both Restlet 1.0.9 and yesterday's trunk. It worked ok as an application using the embedded Simple 3.1 though.

The problem can be reproduced by modifying TestServletApplication.java included within src\org.restlet.example\org\restlet\example\dist\testServlet.zip, adding after:
    public Restlet createRoot() {
      if (true)
        return new Directory(getContext(), "file:///c:/restlet/docs/api/");

Searching the mail archive, I found this in http://article.gmane.org/gmane.comp.java.restlet/4707
from James Horsley <james.horsley <at> gmail.com> who mentioned

After some debugging I tracked my problem down to
have "/*" as my servlet mapping which was causing
HttpServletRequest.getServletPath() to return "". Restlet was using that result
to determine what the base path was so ended up using the whole path
"<http://localhost:1234/blah/56>http://localhost:1234/blah/56"; when matching against the routes, so of course
"/blah/{id}" isn't going to match.

Could this be the same problem? What should the servlet-mapping value be set to?

I also noticed that there were 2 warnings in the console log below, not sure if they are related to this problem.

Cheers,
KC.


May 20, 2008 2:48:31 PM org.restlet.Connector <init>
WARNING: The connector has been instantiated without any protocol.
May 20, 2008 2:48:31 PM org.restlet.Connector <init>
WARNING: The connector has been instantiated without any protocol.
2008-05-20 14:48:31.658:/rest:INFO:  RestletServlet: [Noelios Restlet Engine] -
Attaching application: [EMAIL PROTECTED] to URI: /rest
May 20, 2008 2:48:31 PM com.noelios.restlet.local.DirectoryResource getVariants
INFO: Getting variants for : file:///c:/restlet/docs/api/index
May 20, 2008 2:48:31 PM com.noelios.restlet.local.DirectoryResource <init>
INFO: Converted target URI: file:///c:/restlet/docs/api/index
May 20, 2008 2:48:31 PM com.noelios.restlet.local.DirectoryResource <init>
INFO: Converted base name : index
May 20, 2008 2:48:31 PM com.noelios.restlet.LogFilter afterHandle
INFO: 2008-05-20        14:48:31        192.168.1.108   -       192.168.1.108
8080    GET     /rest/  -       404     330     -       31      http://m8:8080
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14 -

Reply via email to