I would like to be able to have scoped beans for Alfresco WebApplication Context from a servlet (not faces). In order to get it to work I had to do the following:In the web.xml, add the following:<web-app>
…
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
…
</web-app>
In my module-context.xml, add the following (Note I added 2.0 to my DOCTYPE):<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
…
<bean id="PageRequestState" class="com.tlhc.wc.website.PageRequestState" scope="request" >
…
</bean>
</beans>
and get the bean with the following: WebApplicationContext wc = RequestContextUtils.getWebApplicationContext(request, sc);
PageRequestState prs = (PageRequestState)wc.getBean(PageRequestState.PAGE_REQUEST_STATE);
It works but I am surprised Alfresco does not already support it. Am I missing something? I realized you can do it in the Faces Container, but I need to be able to scope my beans it from a servlet.