本文整理汇总了Java中org.apache.commons.configuration.FileConfiguration.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java FileConfiguration.getProperty方法的具体用法?Java FileConfiguration.getProperty怎么用?Java FileConfiguration.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.configuration.FileConfiguration
的用法示例。
在下文中一共展示了FileConfiguration.getProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.apache.commons.configuration.FileConfiguration; //导入方法依赖的package包/类
@Button(list = "settings", key = "update", order = 1, type = Button.TYPE_PRIMARY)
public Resolution update() {
setupFormAndBean();
form.readFromRequest(context.getRequest());
if (form.validate()) {
logger.debug("Applying settings to model");
try {
FileConfiguration fileConfiguration = (FileConfiguration) configuration;
Settings settings = new Settings();
form.writeToObject(settings);
fileConfiguration.setProperty(PortofinoProperties.APP_NAME, settings.appName);
fileConfiguration.setProperty(PortofinoProperties.LANDING_PAGE, settings.landingPage);
fileConfiguration.setProperty(PortofinoProperties.LOGIN_PAGE, settings.loginPage);
if(!settings.preloadGroovyPages ||
fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES) != null) {
fileConfiguration.setProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES, settings.preloadGroovyPages);
}
if(!settings.preloadGroovyClasses ||
fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES) != null) {
fileConfiguration.setProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES, settings.preloadGroovyClasses);
}
fileConfiguration.save();
logger.info("Configuration saved to " + fileConfiguration.getFile().getAbsolutePath());
} catch (Exception e) {
logger.error("Configuration not saved", e);
SessionMessages.addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved"));
return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
}
SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully"));
return new RedirectResolution(this.getClass());
} else {
return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
}
}
示例2: update
import org.apache.commons.configuration.FileConfiguration; //导入方法依赖的package包/类
@Button(list = "settings", key = "update", order = 1, type = Button.TYPE_PRIMARY)
public Resolution update() {
setupFormAndBean();
form.readFromRequest(context.getRequest());
if (form.validate()) {
logger.debug("Applying settings to model");
try {
FileConfiguration fileConfiguration = (FileConfiguration) configuration;
Settings settings = new Settings();
form.writeToObject(settings);
fileConfiguration.setProperty(PortofinoProperties.APP_NAME, settings.appName);
fileConfiguration.setProperty(PortofinoProperties.LANDING_PAGE, settings.landingPage);
fileConfiguration.setProperty(PortofinoProperties.LOGIN_PAGE, settings.loginPage);
if (!settings.preloadGroovyPages
|| fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES) != null) {
fileConfiguration
.setProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES, settings.preloadGroovyPages);
}
if (!settings.preloadGroovyClasses
|| fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES) != null) {
fileConfiguration.setProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES,
settings.preloadGroovyClasses);
}
fileConfiguration.save();
logger.info("Configuration saved to " + fileConfiguration.getFile().getAbsolutePath());
} catch (Exception e) {
logger.error("Configuration not saved", e);
SessionMessages.addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved"));
return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
}
SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully"));
return new RedirectResolution(this.getClass());
} else {
return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
}
}