Hi Vincent,

It appears that your message stayed unanswered for a while...

It think that the second approach using WadlApplication directly should
work. In your subclass you should obtain the WADL representation and then
pass it to the parent constructor:

public class MyApplication extends WadlApplication{

        public MyApplication(Context context) {
                super(context, getWadl(context));
      }

      private static Representation getWadl(Context context){
                // get the WADL file, leveraging the "war://" scheme with
            // the given context
      }

Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : Vincent Ricard [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 12 août 2008 15:39
À : [email protected]
Objet : Wadl and servlet container

Hi,

I can now load a wadl in my servlet container (thanks to ServerServlet),
but i need to access to the ServletContext. I thought i got a
ServletContextAdapter in my resource constructor, but i get a
ComponentContext.

Indeed, i need the ServletContext to load some spring beans (persistance
layer and other business beans) with the
'WebApplicationContextUtils.getWebApplicationContext' spring method.

Since the WadlComponent is created in the ServerServlet.createComponent
method, it does not know the servlet context.

So, what's the best way to get what i want (load a wadl file and access to
my spring context)?

I tried to not use the restlet.xml way and create a class inheriting
WadlApplication (which is loaded by the createApplication method with the
ServletContextAdapter)... but i don't find a simple way to load my wadl
with this way.

Any help is welcome ;-)

PS: could it make sense doing this in createComponent()?
component.setContext(
new ServletContextAdapter(this, componentcontext));
-- 
Vincent Ricard

Reply via email to