本文整理汇总了Java中com.alibaba.druid.wall.WallFilter类的典型用法代码示例。如果您正苦于以下问题:Java WallFilter类的具体用法?Java WallFilter怎么用?Java WallFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WallFilter类属于com.alibaba.druid.wall包,在下文中一共展示了WallFilter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: wallFilter
import com.alibaba.druid.wall.WallFilter; //导入依赖的package包/类
@Bean
@ConditionalOnProperty(prefix = DRUID_WALL_FILTER_PREFIX, name = "enabled", havingValue = "true")
@ConfigurationProperties(DRUID_WALL_FILTER_PREFIX)
public WallFilter wallFilter(WallConfig wallConfig) {
log.debug("druid wall-filter init...");
WallFilter filter = new WallFilter();
filter.setConfig(wallConfig);
return filter;
}
开发者ID:drtrang,项目名称:druid-spring-boot,代码行数:10,代码来源:DruidAutoConfiguration.java
示例2: init
import com.alibaba.druid.wall.WallFilter; //导入依赖的package包/类
public AutoGen init(String configPath) throws IOException {
if(configPath == null || configPath.length() == 0){
configPath = PathKit.getRootClassPath() + "/defaultRule.json" ;
}
config = getConfig(configPath) ;
if(config == null){
throw new NullPointerException("No Config.");
}
JSONObject dataSourceConfig = config.getJSONObject("dataSource") ;
dp = new DruidPlugin(
dataSourceConfig.getString("url"),
dataSourceConfig.getString("user"),
dataSourceConfig.getString("pwd")
);
dp.addFilter(new StatFilter());
WallFilter wall = new WallFilter();
wall.setDbType("mysql");
WallConfig wallConfig = new WallConfig();
wallConfig.setFunctionCheck(false);
wallConfig.setCreateTableAllow(true);
wallConfig.setCommentAllow(true);
wallConfig.setMultiStatementAllow(true);
wall.setConfig(wallConfig);
dp.addFilter(wall);
arp = new ActiveRecordPlugin(dp);
arp.setContainerFactory(new CaseInsensitiveContainerFactory(true));// 大小写不敏感
arp.setDialect(new MysqlDialect());
dp.start();
arp.start();
resourceLoader = new FileResourceLoader(config.getString("baseTemplatePath"),"utf-8");
cfg = Configuration.defaultConfiguration();
gt = new GroupTemplate(resourceLoader, cfg);
System.out.println("-- init success .");
return this ;
}
开发者ID:devilyaos,项目名称:AutoGenerate,代码行数:36,代码来源:AutoGen.java
示例3: buildDruidDataSource
import com.alibaba.druid.wall.WallFilter; //导入依赖的package包/类
/**
* 创建数据源,有前缀
*
* @param dataSourceMap
* @param prefix
* @return
* @throws SQLException
*/
private DruidDataSource buildDruidDataSource(Map<String, Object> dataSourceMap, String prefix) throws SQLException {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setName(MapUtils.getString(dataSourceMap, prefix + "name"));
dataSource.setDriverClassName(MapUtils.getString(dataSourceMap, prefix + "driverClass"));
dataSource.setUrl(MapUtils.getString(dataSourceMap, prefix + "url"));
dataSource.setUsername(MapUtils.getString(dataSourceMap, prefix + "username"));
dataSource.setPassword(MapUtils.getString(dataSourceMap, prefix + "password"));
// 配置过滤器
WallFilter wallFilter = new WallFilter();
StatFilter statFilter = new StatFilter();
statFilter.setSlowSqlMillis(5000);
statFilter.setLogSlowSql(true);
statFilter.setMergeSql(true);
Slf4jLogFilter slf4jLogFilter = new Slf4jLogFilter();
slf4jLogFilter.setDataSourceLogEnabled(false);
slf4jLogFilter.setConnectionLogEnabled(false);
slf4jLogFilter.setConnectionLogErrorEnabled(true);
slf4jLogFilter.setResultSetLogEnabled(false);
slf4jLogFilter.setResultSetLogErrorEnabled(true);
slf4jLogFilter.setStatementLogEnabled(false);
slf4jLogFilter.setStatementExecutableSqlLogEnable(true);
slf4jLogFilter.setStatementSqlFormatOption(new SQLUtils.FormatOption(false, false));
List filterList = new ArrayList();
filterList.add(wallFilter);
filterList.add(statFilter);
filterList.add(slf4jLogFilter);
dataSource.setProxyFilters(filterList);
return dataSource;
}
开发者ID:lupindong,项目名称:xq_seckill_microservice,代码行数:41,代码来源:DynamicDataSourceRegister.java
示例4: getWallStatValue
import com.alibaba.druid.wall.WallFilter; //导入依赖的package包/类
public WallProviderStatValue getWallStatValue(boolean reset) {
for (Filter filter : this.filters) {
if (filter instanceof WallFilter) {
WallFilter wallFilter = (WallFilter) filter;
return wallFilter.getProvider().getStatValue(reset);
}
}
return null;
}
开发者ID:mazhou,项目名称:es-sql,代码行数:11,代码来源:ElasticSearchDruidDataSource.java
示例5: initialize
import com.alibaba.druid.wall.WallFilter; //导入依赖的package包/类
@Override
public void initialize() throws SQLException {
Prop prop = PropKit.use(DB_CONFIG);
druidPlugin = new DruidPlugin(prop.get("jdbcUrl"), prop.get("user"), prop.get("password"));
// StatFilter提供JDBC层的统计信息
druidPlugin.addFilter(new StatFilter());
// WallFilter的功能是防御SQL注入攻击
WallFilter wallFilter = new WallFilter();
wallFilter.setDbType("mysql");
druidPlugin.addFilter(wallFilter);
druidPlugin.start();
}
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:14,代码来源:QuartzConnectionProvider.java
示例6: getDruidPlugin
import com.alibaba.druid.wall.WallFilter; //导入依赖的package包/类
/**
* DruidPlugin
* @param prop : property
* @return
*/
private DruidEncryptPlugin getDruidPlugin(String ds) {
this.loadPropertyFile();
String url = this.getProperty(String.format("db.%s.url", ds));
url = String.format(URL_TEMPLATE, ds, url);
String endsWith = "?characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull";
if (!url.endsWith(endsWith)) {
url += endsWith;
}
DruidEncryptPlugin dp = new DruidEncryptPlugin(url,
this.getProperty(String.format(USER_TEMPLATE, ds)),
this.getProperty(String.format(PASSWORD_TEMPLATE, ds)));
dp.setInitialSize(this.getPropertyToInt(String.format(INITSIZE_TEMPLATE, ds)));
dp.setMaxActive(this.getPropertyToInt(String.format(MAXSIZE_TEMPLATE, ds)));
dp.addFilter(new StatFilter());
WallFilter wall = new WallFilter();
wall.setDbType(ds);
dp.addFilter(wall);
if (this.geRuned) {
dp.start();
BaseModelGeneratorExt baseGe = new BaseModelGeneratorExt(this.getBaseModelPackage(), this.getBaseModelOutDir());
baseGe.setGenerateTableNameInModel(this.getGeTableNameInModel());
baseGe.setGenerateTableColumnNameInModel(this.getGeTableColumnName());
ModelGenerator modelGe = new ModelGenerator(this.getModelPackage(), this.getBaseModelPackage(), this.getModelOutDir());
modelGe.setGenerateDaoInModel(this.getGeDaoInModel());
Generator ge = new Generator(dp.getDataSource(), baseGe, modelGe);
MappingKitGeneratorExt mappingKitGe = new MappingKitGeneratorExt(this.getModelPackage(), this.getModelOutDir());
if (!JFinalConfigExt.DEFAULT_MAPPINGKIT_CLASS_NAME.equals(this.getMappingKitClassName())) {
mappingKitGe.setMappingKitClassName(this.getMappingKitClassName());
}
mappingKitGe.setGenerateMappingArpKit(this.getGeMappingArpKit());
mappingKitGe.setGenerateTableMapping(this.getGeTableMapping());
ge.setMappingKitGenerator(mappingKitGe);
ge.setGenerateDataDictionary(this.getGeDictionary());
ge.generate();
}
return dp;
}
开发者ID:OpeningO,项目名称:JFinal-ext2,代码行数:45,代码来源:JFinalConfigExt.java
注:本文中的com.alibaba.druid.wall.WallFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论