[seam-dev] Loading resources from the ServletContext

Stuart Douglas stuart at baileyroberts.com.au
Fri Apr 9 07:29:44 EDT 2010


I know there are plans to add loading resources from the ServletContext to the resource loading stuff in weld extensions, and I was wondering if anyone had any idea's as to how to implement this?

I was thinking about registering a ServletContextListener to get hold of the ServletContext. For a war deployment this could be registered automatically with a web fragment, while for an ear this will probably have to be registered manually. 

The only thing I am not really sure about is where to store the references to the ServletContexts. As this is before Weld has started, I can't just stick it in an application scoped bean or similar, and storing it in a static would require weld-extensions (and thus seam-xml, and any other modules that depend upon weld-extensions) to be included in the deployment, and not in the app servers lib directory. I don't think that this is really acceptable, however I can't think of any other way off the the top of my head.

I really need this before the next release of seam-xml, as I currently can't load beans.xml from WEB-INF.

Stuart


More information about the seam-dev mailing list