Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
1.0-beta1
-
None
Description
add a ResourceFactory interface to the xwork component interceptor framework with two method Object create(Map param) and void dispose(Object resource). This would allow the use of resource that couldn't be instantiated using empty constructor and also free the action of the resource initialization and disposal responsibility.
A standard bean resource factory should be provided for the simplest case of javabean type of resources.
For e.g,
<component>
<scope>session</scope>
<enabler>com.opensymphony.webwork.example.counter.CounterAware</enabler>
<factory name="com.opensymphony.xwork.interceptor.component.BeanResourceFactory">
<param name="class" value="com.opensymphony.webwork.example.counter.Counter"/>
</factory>
</component>
For a more interesting example, we can make hibernate Session a resource and have the following.
<component>
<scope>request</scope>
<enabler>com.opensymphony.webwork.example.HibernateAware</enabler>
<factory name="com.opensymphony.webwork.example.HibernateSessionFactory"/>
</component>