@Bobv

One thing about RequestFactoryServlet is that it is somewhat difficult to 
setup DI from containers such as Spring. I've been working on getting Spring 
wired into the request factory framework and there are a bunch of examples, 
but they all are pretty ugly. I think I've found a fairly clean solution, 
and it only involves a minimal change to RequestFactoryServlet to 
accomplish.

If we added ServletContext to a ThreadLocal, the same way we add HttpRequest 
and HttpResponse, then it becomes trivial to get the servlet context out of 
the request factory.

Then creating your Spring locator can look like : 

public class SpringServiceLocator implements ServiceLocator {

    public Object getInstance(Class<?> arg0) {
        
        ApplicationContext ctx = 
WebApplicationContextUtils.getWebApplicationContext(SpringRequestFactoryServlet.getThreadLocalServletContext().get());
        return ctx.getBean(arg0);
    }

}

and with Spring 3, everything should roll together nicely (I'm in the middle 
of working this out, but this should work). 

I'm will implement this for my project. My question is, Does it makes sense 
to add the ServletContext into RequestFactoryServlet inside GWT proper? If 
so, I can submit a patch for you. 

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to