本文整理汇总了Java中com.jfinal.config.Constants.setError500View方法的典型用法代码示例。如果您正苦于以下问题:Java Constants.setError500View方法的具体用法?Java Constants.setError500View怎么用?Java Constants.setError500View使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfinal.config.Constants
的用法示例。
在下文中一共展示了Constants.setError500View方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
/**
* 配置常量
*/
@Override
public void configConstant(Constants me) {
druidConfig = loadPropertyFile("config/bruid.properties");
// 加载少量必要配置,随后可用getProperty(...)获取值
me.setDevMode(getPropertyToBoolean("devMode", false));
me.setViewType(ViewType.JSP); // 设置视图类型为Jsp,否则默认为FreeMarker
me.setEncoding("UTF-8");
me.setBaseViewPath("/WEB-INF/pages");
me.setError404View("/404.jsp");
me.setError403View("/500.jsp");
me.setError500View("/500.jsp");
me.setError401View("/500.jsp");
JspRender.setSupportActiveRecord(false);
}
示例2: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
/**
* Config constant
*
* Default <br/>
* ViewType: JSP <br/>
* Encoding: UTF-8 <br/>
* ErrorPages: <br/>
* 404 : /WEB-INF/errorpages/404.jsp <br/>
* 500 : /WEB-INF/errorpages/500.jsp <br/>
* 403 : /WEB-INF/errorpages/403.jsp <br/>
* UploadedFileSaveDirectory : cfg basedir + appName <br/>
*/
public void configConstant(Constants me) {
me.setViewType(ViewType.JSP);
me.setDevMode(this.getAppDevMode());
me.setEncoding(Const.DEFAULT_ENCODING);
me.setError404View(PageViewKit.get404PageView());
me.setError500View(PageViewKit.get500PageView());
me.setError403View(PageViewKit.get403PageView());
//file upload dir
me.setBaseUploadPath(this.getUploadPath());
//file download dir
me.setBaseDownloadPath(this.getDownloadPath());
JFinalConfigExt.APP_NAME = this.getAppName();
//set file rename policy is random
OreillyCos.setFileRenamePolicy(new RandomFileRenamePolicy());
// config others
configMoreConstants(me);
}
示例3: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
/**
* 配置常量
*/
public void configConstant(Constants me) {
me.setDevMode(isDevMode());
me.setViewType(ViewType.JSP); // 设置视图类型为Jsp,否则默认为FreeMarker
me.setLogFactory(new Log4jLogFactory());
me.setError401View(Config.getStr("PAGES.401"));
me.setError403View(Config.getStr("PAGES.403"));
me.setError404View(Config.getStr("PAGES.404"));
me.setError500View(Config.getStr("PAGES.500"));
}
示例4: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
public void configConstant(Constants me) {
loadProp("a_little_config_pro.txt", "a_little_config.txt");
me.setDevMode(PropKit.getBoolean("devMode", false));
me.setViewType(ViewType.JSP);
// ApiConfigKit 设为开发模式可以在开发阶段输出请求交互的 xml 与 json 数据
ApiConfigKit.setDevMode(me.getDevMode());
//设置404跳转页面
me.setError404View("/_front/common/404.html");
me.setError500View("/_front/common/500.html");
}
示例5: onConfigConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
@Override
protected void onConfigConstant(Constants me) {
me.setBaseViewPath("/WEB-INF/pages");
me.setDevMode(PropKit.getBoolean("devMode", false));
me.setEncoding(Const.DEFAULT_ENCODING);
me.setError404View("/WEB-INF/error/404.html");
me.setError500View("/WEB-INF/error/500.html");
// freemarker add static template
Set<String> packages = new HashSet<>();
packages.add("com.codeyn.wechat.*.enums");
packages.add("com.codeyn.wechat.utils");
packages.add("com.codeyn.wechat.jfinal.bridger");
Set<Class<?>> clazzes = PackageScanner.scanPackage(packages.toArray(new String[packages.size()]));
for (Class<?> clazz : clazzes) {
TemplateHashModel tmp = buildStaticTemplate(clazz.getName());
FreeMarkerRender.getConfiguration().setSharedVariable(clazz.getSimpleName(), tmp);
}
// TODO download
me.setFileRenderPath("/download");
// TODO upload smartUpload
me.setUploadedFileSaveDirectory("/upload");
}
示例6: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
@Override
public void configConstant(Constants constants) {
// set config propertis.
configuration = GojaConfig.getConfigProps();
// dev_mode
final ApplicationMode applicationMode = GojaConfig.getApplicationMode();
final boolean isDev = applicationMode.isDev();
constants.setDevMode(isDev);
// fixed: render view has views//xxx.ftl
final String DEFAULT_VIEW_PATH = PageViewKit.WEBINF_DIR + "views";
viewPath = GojaConfig.getProperty(GojaPropConst.APP_VIEWPATH, DEFAULT_VIEW_PATH);
constants.setBaseViewPath(viewPath);
if (applicationMode.isProd()) {
// 404由于在开发模式下的提示信息,由于404触发的,所以在开发模式不启动404视图界面
constants.setError404View(PageViewKit.get404PageView());
}
constants.setError500View(PageViewKit.get500PageView());
constants.setError403View(PageViewKit.get403PageView());
appName = GojaConfig.getAppName();
// init wxchat config
final String wx_url = GojaConfig.getProperty(GojaPropConst.APP_WXCHAT_URL);
if (!Strings.isNullOrEmpty(wx_url)) {
// Config Wx Api
ApiConfigKit.setDevMode(isDev);
}
if (GojaConfig.isSecurity()) {
final Set<Class<? extends SecurityUserData>> securityUserClass = ClassPathScanning.scan(SecurityUserData.class);
if (CollectionUtils.isNotEmpty(securityUserClass)) {
for (Class<? extends SecurityUserData> securityUserClas : securityUserClass) {
try {
securityUserData = securityUserClas.newInstance();
break;
} catch (InstantiationException | IllegalAccessException e) {
logger.error("the security user data has error!", e);
}
}
}
}
final boolean jspViewType = GojaConfig.getPropertyToBoolean(GojaPropConst.APP_VIEW_JSP, false);
if (jspViewType) {
constants.setViewType(ViewType.JSP);
} else {
constants.setFreeMarkerViewExtension(".ftl");
setFtlSharedVariable();
}
if (isDev) {
constants.setErrorRenderFactory(new GojaErrorRenderFactory());
}
final int uploadMaxFileSize = GojaConfig.getPropertyToInt(GojaPropConst.APP_UPLOAD_MAXFILESIZE, Const.DEFAULT_MAX_POST_SIZE);
constants.setMaxPostSize(uploadMaxFileSize);
final String attachmentPath = GojaConfig.getProperty(GojaPropConst.APP_UPLOAD_PATH, "attachment");
constants.setBaseUploadPath(attachmentPath);
constants.setBaseDownloadPath(attachmentPath);
final String jsonMode = GojaConfig.getJsonMode();
if (!Strings.isNullOrEmpty(jsonMode)) {
if (StringUtils.equalsIgnoreCase("fastjson", jsonMode)) {
constants.setJsonFactory(new FastJsonFactory());
} else if (StringUtils.equalsIgnoreCase("jackson", jsonMode)) {
constants.setJsonFactory(new JacksonFactory());
}
}
final String fileRenamePolicy = GojaConfig.getProperty(GojaPropConst.APP_UPLOAD_FILERENAMEPOLICY, "default");
if (StringUtils.equalsIgnoreCase(fileRenamePolicy, "date")) {
OreillyCos.setFileRenamePolicy(new DateRandomFileRenamePolicy());
} else if (StringUtils.equalsIgnoreCase(fileRenamePolicy, "radom")) {
OreillyCos.setFileRenamePolicy(new RandomFileRenamePolicy());
} else if (StringUtils.equalsIgnoreCase(fileRenamePolicy, "default")) {
OreillyCos.setFileRenamePolicy(new DefaultFileRenamePolicy());
} else {
logger.warn("Upload folder naming of the unknown!");
}
}