当前位置: 首页>>代码示例>>Java>>正文


Java Constants.setBaseDownloadPath方法代码示例

本文整理汇总了Java中com.jfinal.config.Constants.setBaseDownloadPath方法的典型用法代码示例。如果您正苦于以下问题:Java Constants.setBaseDownloadPath方法的具体用法?Java Constants.setBaseDownloadPath怎么用?Java Constants.setBaseDownloadPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jfinal.config.Constants的用法示例。


在下文中一共展示了Constants.setBaseDownloadPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
}
 
开发者ID:OpeningO,项目名称:JFinal-ext2,代码行数:31,代码来源:JFinalConfigExt.java

示例2: 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!");
    }
}
 
开发者ID:GojaFramework,项目名称:goja,代码行数:82,代码来源:Goja.java


注:本文中的com.jfinal.config.Constants.setBaseDownloadPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。