|
|
@ -2,6 +2,9 @@ package ${basePackage}.config;
|
|
|
|
|
|
|
|
|
|
|
|
import ${basePackage}.frame.auth.LocalData;
|
|
|
|
import ${basePackage}.frame.auth.LocalData;
|
|
|
|
import ${basePackage}.frame.base.Control;
|
|
|
|
import ${basePackage}.frame.base.Control;
|
|
|
|
|
|
|
|
import ${basePackage}.frame.utils.UrlUtil;
|
|
|
|
|
|
|
|
import static ${basePackage}.config.ActionConfig.CONTROL_PREFIX;
|
|
|
|
|
|
|
|
import static ${basePackage}.config.ActionConfig.SCREEN_PREFIX;
|
|
|
|
import freemarker.template.SimpleScalar;
|
|
|
|
import freemarker.template.SimpleScalar;
|
|
|
|
import freemarker.template.TemplateMethodModelEx;
|
|
|
|
import freemarker.template.TemplateMethodModelEx;
|
|
|
|
import freemarker.template.TemplateModelException;
|
|
|
|
import freemarker.template.TemplateModelException;
|
|
|
@ -32,8 +35,7 @@ public class FreeMarkerConfig {
|
|
|
|
private freemarker.template.Configuration configuration;
|
|
|
|
private freemarker.template.Configuration configuration;
|
|
|
|
@Value("${r'${server.servlet.context-path}'}")
|
|
|
|
@Value("${r'${server.servlet.context-path}'}")
|
|
|
|
private String context;
|
|
|
|
private String context;
|
|
|
|
private String screenPrefix = "/screen/";
|
|
|
|
|
|
|
|
private String controlPrefix = "/control/";
|
|
|
|
|
|
|
|
private String suffix = ".ftl";
|
|
|
|
private String suffix = ".ftl";
|
|
|
|
|
|
|
|
|
|
|
|
@PostConstruct
|
|
|
|
@PostConstruct
|
|
|
@ -42,6 +44,7 @@ public class FreeMarkerConfig {
|
|
|
|
configuration.setSharedVariable("context", context);
|
|
|
|
configuration.setSharedVariable("context", context);
|
|
|
|
configuration.setSharedVariable("screenHolder", new ScreenHolder());
|
|
|
|
configuration.setSharedVariable("screenHolder", new ScreenHolder());
|
|
|
|
configuration.setSharedVariable("controlHolder", new ControlHolder());
|
|
|
|
configuration.setSharedVariable("controlHolder", new ControlHolder());
|
|
|
|
|
|
|
|
configuration.setSharedVariable("UrlUtil", new UrlUtil());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private class ScreenHolder implements TemplateMethodModelEx {
|
|
|
|
private class ScreenHolder implements TemplateMethodModelEx {
|
|
|
@ -72,7 +75,7 @@ public class FreeMarkerConfig {
|
|
|
|
if (view == null) {
|
|
|
|
if (view == null) {
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return screenPrefix + servletPath + suffix;
|
|
|
|
return SCREEN_PREFIX + servletPath + suffix;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
@ -97,7 +100,7 @@ public class FreeMarkerConfig {
|
|
|
|
// 查找是否存在对应控制面板执行器
|
|
|
|
// 查找是否存在对应控制面板执行器
|
|
|
|
Control controlExec = null;
|
|
|
|
Control controlExec = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
controlExec = LocalData.getApplicationContext().getBean(ActionConfig.CONTROL_PREFIX + "." + control, Control.class);
|
|
|
|
controlExec = LocalData.getApplicationContext().getBean(CONTROL_PREFIX + control, Control.class);
|
|
|
|
|
|
|
|
|
|
|
|
HttpServletRequest request = LocalData.getRequest();
|
|
|
|
HttpServletRequest request = LocalData.getRequest();
|
|
|
|
HttpServletResponse response = LocalData.getResponse();
|
|
|
|
HttpServletResponse response = LocalData.getResponse();
|
|
|
@ -113,7 +116,7 @@ public class FreeMarkerConfig {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
control = control.replaceAll("/", File.separator);
|
|
|
|
control = control.replaceAll("/", File.separator);
|
|
|
|
return controlPrefix + control + suffix;
|
|
|
|
return CONTROL_PREFIX + control + suffix;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|