Hi there,
         I am just hacking up my first restlet app. I'm really impressed so 
far. 

In addition to some resources served RESTfully, i'd also like to serve some
static comment of the classpath... and so have been trying a bunch of things to
expose a dir on the classpath without success so far. Any help appreciated!

env: restlet as war in jetty container.

web.xml:

   <!-- Application class name -->
   <context-param>
      <param-name>org.restlet.application</param-name>
      <param-value>
         au.com.internode.udr2d2.SimpleUsageApplication
      </param-value>
   </context-param>

   <!-- Restlet adapter -->
   <servlet>
      <servlet-name>RestletServlet</servlet-name>
      <servlet-class>
         com.noelios.restlet.ext.servlet.ServerServlet
      </servlet-class>
   </servlet>

   <!-- Catch all requests -->
   <servlet-mapping>
      <servlet-name>RestletServlet</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>

Restlet:
 public synchronized Restlet createRoot() {

    Router router = new Router(getContext());

    // Defines a default route with the URL format.
    router.attachDefault(UsageFormatResource.class);

    // Create a directory able to expose a hierarchy of files
    Directory directory = new Directory(getContext(), "clap://images/");
    router.attach(directory);

    // And add the
    Route route = router.attach(SimpleUsageResource.URI_FORMAT,
SimpleUsageResource.class);
    route.getTemplate().setMatchingMode(Template.MODE_EQUALS);

    return router;
  }

--

The basic behavior is that a request to load:

http://localhost:8280/udr2d2/images/ajax-loader.gif

returns the default UsageFormatResource.class.

I tried adding the Protocol.CLAP and got a message to the client and server
connector list (this was a bit mindless - i'm not sure which i need! certainly
not both). And got a log message about the classpath loader not being loaded.

I've googled around a fair bit, read through the tute, looked through the Java
doc and tried rearranging ordering when creating the router. And eventually
thought: "time to post".

Any help appreciated! :-)

  mattb

Reply via email to