Hi Ruben, Your component should be automatically started on first request handling. But there might be something not fully initialized on the first call. To workaround this, I would suggest to use the "init-method" attribute on your component element in the Spring XML. Best regards, Jérôme Louvel -- Restlet ~ Founder and Lead developer ~ <http://www.restlet.org/> http://www.restlet.org Noelios Technologies ~ Co-founder ~ <http://www.noelios.com/> http://www.noelios.com
_____ De : Ruben Hernando [mailto:[email protected]] Envoyé : lundi 19 janvier 2009 09:21 À : [email protected] Cc : [email protected] Objet : RE: Re: Browse a Directory from a web application inside jboss hello! I think it maybe caused by the component because I am not calling component.start() method I'm instantiating all components and resources from applicatonContext.xml in Spring. So, can you tell me a way to start my component from spring configuration? thanks, Ruben Jerome Louvel <[email protected]> 16/01/2009 16:41 Por favor, responda a discuss <[email protected]> Para [email protected] cc Asunto RE: Re: Browse a Directory from a web application inside jboss Hi Ruben, It must be an issue with your component, here is a sample that works: import org.restlet.Application; import org.restlet.Component; import org.restlet.Directory; import org.restlet.Restlet; import org.restlet.data.Protocol; public class SpringDirectory extends Application { @Override public Restlet createRoot() { return new Directory(getContext(), " <file:///c:/templates/> file:///c:/templates/"); } public static void main(String[] args) throws Exception { // Create a new Restlet component final Component component = new Component(); component.getServers().add(Protocol.HTTP, 9876); component.getDefaultHost().attach(new SpringDirectory()); component.start(); } } Best regards, Jérôme Louvel -- Restlet ~ Founder and Lead developer ~ <http://www.restlet.org/> http://www.restlet.org Noelios Technologies ~ Co-founder ~ <http://www.noelios.com/> http://www.noelios.com -----Message d'origine----- De : Ruben Hernando [mailto:[email protected]] Envoyé : vendredi 16 janvier 2009 12:22 À : [email protected] Objet : RE: Re: Browse a Directory from a web application inside jboss Hello, I created the Directory in that way and it worked, but when I start my server whows an error whith the first file: GRAVE: The informa.rest.spring.resources.SpringDirectory class has no Restlet defined to process calls. Maybe it wasn't properly started. And it doesn't serve the file (error 500). If I refresh the page in the browser it works. public class SpringDirectory extends Application { @Override public Restlet createRoot() { return new Directory(getComponent().getContext().createChildContext(), " <file:///c:/templates/> file:///c:/templates/"); } I'm using 1.2-SNAPSHOT version. Rubén Hernando > This worked! Thanks for your time. > Brian > > Michael Terrington wrote: > > Hi Brian, > > > > I've been adding the FILE client connector by creating a new component > > and feeding that to the restlet that requires it. Like so: > > > > Component component = new Component(); > > component.getClients().add(Protocol.FILE); > > Directory directory = new > > Directory(component.getContext().createChildContext(), > > " <file:///c:/> > > file:///c:/"); > > directory.setListingAllowed(true); > > router.attach("/files", directory); > > > > BTW the createChildContext() is in 1.1 so if you are using 1.0 just > > remove it. There's also no need for the inner Application containing > > the Directory. > > > > Regards, > > Michael. > > -- > Brian E. Williams > Senior Application Developer > > The Archer Group > 233 King Street > Wilmington, DE 19801 > > w: 302.429.9120 x225 > f: 302.429.8720 > > <http://www.archer-group.com/> http://www.archer-group.com ------------------------------------------------------ <http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1028389> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1028389 ------------------------------------------------------ <http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1028962> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1028962 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1039035

