Re: restlet noob: getting the CLAP (right)
Rob Heittman solertium.com> writes: > > I enthusiastically recommend using a 1.1 milestone or snapshot for any new development. The javadoc for ServerServlet says how to set a custom Component. (just like setting a custom Application, basically) But you can't do that in 1.0. I think the need to add extra client connectors and such was exactly what drove that improvement to ServerServlet. Rob, thanks for your help. the switch to the milestone (1.1) builds did the trick cheers, matt
Re: restlet noob: getting the CLAP (right)
I enthusiastically recommend using a 1.1 milestone or snapshot for any new development. The javadoc for ServerServlet says how to set a custom Component. (just like setting a custom Application, basically) But you can't do that in 1.0. I think the need to add extra client connectors and such was exactly what drove that improvement to ServerServlet. BTW, I am using: 1.0.10 (vice testing or svn suck). >
Re: restlet noob: getting the CLAP (right)
Rob Heittman solertium.com> writes: > > Be sure to do this in your Component constructor or another appropriate spot: > getClients().add(Protocol.CLAP); Rob, thanks very much for your reply. At you'll note, I am extending Application and launching this with ServletServlet. That is, I'm not explicitly creating a Component. So I have two follow ups: 1. If I do create a Component, how do I set up web.xml to launch the Component. alternately, 2. If I stick to Application and ServletServlet, where is the "appropriate spot" to add the Protocol.CLAP... in the context directives of web.xml? > Then you want something like: > Directory directory = new Directory(getContext(), "clap://system/images/"); Ok, thanks - I will experiment. And thanks too for the info on caching. Still poring through the APIs, examples, recipies and googling. Hmmm... BTW, I am using: 1.0.10 (vice testing or svn suck). Thanks again! mattb
Re: restlet noob: getting the CLAP (right)
Be sure to do this in your Component constructor or another appropriate spot: getClients().add(Protocol.CLAP); Then you want something like: Directory directory = new Directory(getContext(), "clap://*system/* images/"); The "host" part of the clap: URI must be specified: one of "system" or "thread" will probably be right for your environment. I find when serving static content via CLAP, I often want to modulate client caching behavior so as not to beat on the classloader with repeat requests -- the classloader does not give reliable information about file modification times for stuff inside a non-extracted WAR or JAR. For a Directory subclass that fakes it, see: http://gogoego.googlecode.com/svn/trunk/modules/RestletFoundation/src/com/solertium/container/ClapCacheDirectory.java - R
Re: restlet noob: getting the CLAP (right)
Forgot to add: in the war, the images directory sits at the top like: + WEB-INF +++ WEB-INF/web.xml + images +++ images/ajax-loader.gif cheers, matt (sorry for a few typos in the post!)
restlet noob: getting the CLAP (right)
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: org.restlet.application au.com.internode.udr2d2.SimpleUsageApplication RestletServlet com.noelios.restlet.ext.servlet.ServerServlet RestletServlet /* 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