Great, thanks Jerome! Dustin
Jerome Louvel wrote: > Hi Dustin, > > Thanks for reporting the issue with SpringServerServlet. I've refactored the > ServerServlet#createComponent() method to separate the configuration aspects > into a new configure(Component) method. > > It means that SpringServerServlet also benefits from this post-creation > configuration (WAR client and parameters copy). Checked in SVN trunk. > > Best regards, > Jerome Louvel > -- > Restlet ~ Founder and Lead developer ~ http://www.restlet.org > Noelios Technologies ~ Co-founder ~ http://www.noelios.com > > > > -----Message d'origine----- > De : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca] > Envoyé : mardi 19 mai 2009 16:19 > À : discuss@restlet.tigris.org > Objet : Re: Spring-loaded Restlets with Context dependencies > > Thanks Jerome, > > The WAR client is only added if the component is created by the > ServerServlet, and not by the SpringServerServlet (i.e. created from a > Spring Bean). > > Cheers, > Dustin > > > Jerome Louvel wrote: > >> Hi Dustin, >> >> Thanks for reporting your solution and for the support! I'm sure it will >> help others. >> >> Regarding the WAR client, it is normally automatically added by the >> ServerServlet#createComponent() method, which is invoked at the end of >> SpringServerServlet#createComponent. No need to declare it anymore. >> >> Best regards, >> Jerome Louvel >> -- >> Restlet ~ Founder and Lead developer ~ http://www.restlet.org >> Noelios Technologies ~ Co-founder ~ http://www.noelios.com >> >> >> -----Message d'origine----- >> De : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca] >> Envoyé : vendredi 15 mai 2009 21:15 >> À : discuss@restlet.tigris.org >> Objet : Re: Spring-loaded Restlets with Context dependencies >> >> I solved this for the most part. I'm using the >> org.springframework.beans.factory.config.PropertyPathFactoryBean class >> to provide a Context to my component, which is now defined in Spring: >> >> <!-- Component. This will be loaded by the Servlet according to the >> web.xml definition of org.restlet.component --> >> <bean name="component" class="org.restlet.ext.spring.SpringComponent"> >> <property name="defaultTarget" ref="application" /> >> <property name="context" ref="component.context" /> >> <property name="clientsList"> >> <list> >> <value>http</value> >> <value>file</value> >> </list> >> </property> >> </bean> >> >> <!-- Context --> >> <bean name="component.context" >> >> class="org.springframework.beans.factory.config.PropertyPathFactoryBean" /> >> >> I had to override the SpringServerServlet.createComponent() method to >> add a ServletWARClient to the Spring loaded component since simply >> declaring 'war' in the clientsList is not sufficient. The >> ServletContext is required to build one of those Clients. I need the >> WAR protocol to load my FreeMarker Templates from my WAR, as well as my >> CSS and JavaScript files. >> >> I hope I did this in the best way possible and didn't miss something >> simple that prevented me from doing the extra work. Maybe this will >> help someone else! >> >> Thanks to the Restlet team for everything. I am enjoying myself none >> the less. >> Dustin >> >> >> >> >> >> Dustin N. Jenkins wrote: >> >> >>> All, >>> >>> I'm using the 1.2 (2.0) snapshot with JDK 1.6. >>> >>> All of my beans are loaded by Spring. This is working really lovely for >>> the most part, except for any bean that relies on the Context to be >>> passed in. How do we create ChallengeGuards, for example, in Spring, >>> when we don't have a Context to pass to it? >>> >>> I used to override the default Constructor to use a Restlet instead of a >>> Context, which would act as a Parent and I could call getContext() from >>> that bean. That Parent bean used to be the Application, which is >>> initialized by the SpringServerServlet. The problem is that Spring is >>> loading in all the beans first, which means the Parent's Context is >>> null, which used to be alright prior to 2.0. >>> >>> What is the solution for this problem? Do I need to create a Spring >>> Component around my Application? I don't use a Component now, only an >>> Application. >>> >>> Thanks! >>> Dustin >>> >>> >>> >> >> > > -- Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca facsimile/télécopieur: (250) 363-0045 National Research Council Canada | 5071 West Saanich Rd, Victoria BC. V9E 2E7 Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria (C.-B) V9E 2E7 Government of Canada | Gouvernement du Canada ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2359782