SmartClient Version: v9.1p_2015-01-30/PowerEdition Deployment (built 2015-01-30)
I am trying to create a simple DMI Factory class that uses CDI to lookup an object. So I am trying to pass the objects class name via defaultParams in the ds.xml operation binding. However I cannot seem to figure out how to successfully set the value in xml. Perhaps you can shed some light on the subject for me?
DMI Factory Class
ds.xml
However, the parameter cdiBean does not exist in the HttpServletRequest.
I am trying to create a simple DMI Factory class that uses CDI to lookup an object. So I am trying to pass the objects class name via defaultParams in the ds.xml operation binding. However I cannot seem to figure out how to successfully set the value in xml. Perhaps you can shed some light on the subject for me?
DMI Factory Class
Code:
public class CDIFactory { private final Logger LOGGER = Logger.getLogger(CDIFactory.class.getName()); public Object create(HttpServletRequest request) throws Exception { String cdiBean = request.getParameter("cdiBean"); LOGGER.warning("CDIFactory.create invoked with cdiBean = " + cdiBean); if(cdiBean == null) { throw new IllegalArgumentException("cdiBean parameter is required"); } return CDI.current().select(Class.forName(cdiBean)).get(); } }
Code:
<serverObject className="com.sncorp.gs2.gsui.server.dmi.CDIFactory" lookupStyle="factory"/> <operationBindings> <operationBinding operationType="custom" operationId="test1" serverMethod="test1"> <defaultParams> <valueMap cdiBean="com.sncorp.dmi.Test"></valueMap> </defaultParams> </operationBinding> <operationBinding operationType="custom" operationId="test2" serverMethod="test2"> <defaultParams> <valueMap cdiBean="com.sncorp.dmi.Test"></valueMap> </defaultParams> </operationBinding> <operationBinding operationType="custom" operationId="test3" serverMethod="test3"> <defaultParams> <valueMap cdiBean="com.sncorp.dmi.Test"></valueMap> </defaultParams> </operationBinding> </operationBindings>
Comment