Hi all, Maybe we could support an additional Servlet parameter that would list the client connectors to attach to the default component? That would remove the need to create a subclass of Component just for that. I've added a note to:
"Support WAR packaging" http://restlet.tigris.org/issues/show_bug.cgi?id=76 Best regards, Jerome > -----Message d'origine----- > De : Thierry Boileau [mailto:[EMAIL PROTECTED] > Envoyé : vendredi 7 mars 2008 11:14 > À : [email protected] > Objet : Re: Trouble with serving static files when using Tomcat. > > Hello Robert and Rob, > > I assume this is not pretty clear... > The response is located in the javadoc of the ServerServlet class [1]. > > By default, this servlet creates a very simple component with no > connectors and attaches your application to it. But just because the > Directory requires the FILE client connector, the component must be > customized. it's quite simple, once you know what to do. > > 1- create your component class (for example > "com.firstStepsServlet.FirstStepsComponent") declaring all the needed > connectors. > package com.firstStepsServlet; > > import org.restlet.Component; > import org.restlet.data.Protocol; > > public class FirstStepsComponent extends Component { > > public FirstStepsComponent() { > super(); > this.getClients().add(Protocol.FILE); > } > } > > 2- update the servlet context with the path to your > customized component. > <context-param> > <param-name>org.restlet.component</param-name> > > <param-value>com.firstStepsServlet.FirstStepsComponent</param-value> > </context-param> > > 3- restart, it should work. > > Well, I think the page must be updated, thanks a lot for > reporting this! > > best regards, > Thierry Boileau > [1] : > http://www.restlet.org/documentation/1.1/ext/com/noelios/restl > et/ext/servlet/ServerServlet.html > > On Fri, Mar 7, 2008 at 4:03 AM, Rob Heittman > <[EMAIL PROTECTED]> wrote: > > > > Hi Rob, > > > > That code looks sane to me in principle. Just a thought, > are you supplying > > the real full filesystem path to > > LocalReference.createFileReference("/path_to/imgdir/")? Using paths > > relative to your webapp root won't work ... > > > > You probably don't actually need the trailing slash in > > component.getDefaultHost().attach("/images/", d), but I > don't really think > > it will hurt either. > > > > Anything interesting in the log (where it's looking for the > file, etc.)? > > > > - Other Rob > > > > > > > > > > On Thu, Mar 6, 2008 at 6:07 PM, Robert Bruggner > <[EMAIL PROTECTED]> > > wrote: > > > Hi All, > > > I'm having a little trouble getting my restlet > application to serve static > > files > > > (files and directories) when deploying via Tomcat and > was wondering if > > > anyone had any suggestions (I'm a bit of a newbie too - > please bear with > > > me). > > > > >

