use of org.directwebremoting.util.FakeHttpServletRequest in project ma-core-public by infiniteautomation.
the class StrutsCreator method getType.
/* (non-Javadoc)
* @see org.directwebremoting.Creator#getType()
*/
public Class getType() {
synchronized (this) {
if (moduleConfig == null) {
WebContext wc = WebContextFactory.get();
if (getInstanceMethod != null) {
try {
// ModuleUtils utils = ModuleUtils.getInstance();
Object utils = getInstanceMethod.invoke(null, new Object[0]);
// String moduleName = utils.getModuleName("/", wc.getServletContext());
String moduleName = (String) getModuleNameMethod.invoke(utils, new Object[] { "/", wc.getServletContext() });
// moduleConfig = utils.getModuleConfig(moduleName, wc.getServletContext());
moduleConfig = (ModuleConfig) getModuleConfigMethod.invoke(utils, new Object[] { moduleName, wc.getServletContext() });
} catch (Exception ex) {
throw new IllegalArgumentException(ex.getMessage());
}
} else {
HttpServletRequest request = wc.getHttpServletRequest();
if (request == null) {
log.warn("Using a FakeHttpServletRequest as part of setup");
request = new FakeHttpServletRequest();
}
moduleConfig = RequestUtils.getModuleConfig(request, wc.getServletContext());
}
}
}
try {
return LocalUtil.classForName(moduleConfig.findFormBeanConfig(formBean).getType());
} catch (ClassNotFoundException ex) {
throw new IllegalArgumentException(Messages.getString("Creator.ClassNotFound", moduleConfig.findFormBeanConfig(formBean).getType()));
}
}
Aggregations