Search in sources :

Example 6 with WallFilter

use of com.alibaba.druid.wall.WallFilter in project druid by alibaba.

the class DruidFilterConfiguration method wallFilter.

@Bean
@ConfigurationProperties(FILTER_WALL_PREFIX)
@ConditionalOnProperty(prefix = FILTER_WALL_PREFIX, name = "enabled")
@ConditionalOnMissingBean
public WallFilter wallFilter(WallConfig wallConfig) {
    WallFilter filter = new WallFilter();
    filter.setConfig(wallConfig);
    return filter;
}
Also used : WallFilter(com.alibaba.druid.wall.WallFilter) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConfigurationProperties(org.springframework.boot.context.properties.ConfigurationProperties) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)

Example 7 with WallFilter

use of com.alibaba.druid.wall.WallFilter in project druid by alibaba.

the class WallFilterTest3 method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:h2:mem:wall_test;");
    // dataSource.setFilters("wall");
    dataSource.setDbType(JdbcConstants.MARIADB);
    WallConfig config = new WallConfig();
    config.setTenantCallBack(new TenantTestCallBack());
    wallFilter = new WallFilter();
    wallFilter.setConfig(config);
    wallFilter.setDbType(JdbcConstants.MARIADB);
    List<Filter> filters = new LinkedList<Filter>();
    filters.add(wallFilter);
    dataSource.setProxyFilters(filters);
    dataSource.init();
}
Also used : WallFilter(com.alibaba.druid.wall.WallFilter) WallFilter(com.alibaba.druid.wall.WallFilter) Filter(com.alibaba.druid.filter.Filter) WallConfig(com.alibaba.druid.wall.WallConfig) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) LinkedList(java.util.LinkedList)

Example 8 with WallFilter

use of com.alibaba.druid.wall.WallFilter in project druid by alibaba.

the class TestOracleWall3 method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    WallFilter wall = new WallFilter();
    wall.setConfig(new WallConfig());
    wall.getConfig().setWrapAllow(true);
    dataSource.setOracle(true);
    dataSource.setUrl("jdbc:mock:xxx");
    dataSource.setDriver(new OracleMockDriver());
    dataSource.setPoolPreparedStatements(true);
    dataSource.setConnectionProperties("defaultRowPrefetch=50");
    dataSource.setFilters("stat");
    dataSource.getProxyFilters().add(wall);
    dataSource.setDbType("oracle");
// dataSource.setFilters("log4j");
}
Also used : WallFilter(com.alibaba.druid.wall.WallFilter) WallConfig(com.alibaba.druid.wall.WallConfig) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) OracleMockDriver(com.alibaba.druid.test.util.OracleMockDriver)

Example 9 with WallFilter

use of com.alibaba.druid.wall.WallFilter in project druid by alibaba.

the class TestOracleWallJdbc3 method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    WallFilter wall = new WallFilter();
    wall.setConfig(new WallConfig());
    wall.getConfig().setWrapAllow(true);
    dataSource.setOracle(true);
    dataSource.setUrl("jdbc:mock:xxx");
    dataSource.setDriver(new OracleMockDriverJdbc3());
    dataSource.setPoolPreparedStatements(true);
    dataSource.setConnectionProperties("defaultRowPrefetch=50");
    dataSource.setFilters("stat");
    dataSource.getProxyFilters().add(wall);
    dataSource.setDbType("oracle");
// dataSource.setFilters("log4j");
}
Also used : OracleMockDriverJdbc3(com.alibaba.druid.test.util.OracleMockDriverJdbc3) WallFilter(com.alibaba.druid.wall.WallFilter) WallConfig(com.alibaba.druid.wall.WallConfig) DruidDataSource(com.alibaba.druid.pool.DruidDataSource)

Aggregations

WallFilter (com.alibaba.druid.wall.WallFilter)9 WallConfig (com.alibaba.druid.wall.WallConfig)6 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)5 Filter (com.alibaba.druid.filter.Filter)3 Bean (org.springframework.context.annotation.Bean)3 StatFilter (com.alibaba.druid.filter.stat.StatFilter)2 WebStatFilter (com.alibaba.druid.support.http.WebStatFilter)2 OracleMockDriver (com.alibaba.druid.test.util.OracleMockDriver)2 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)2 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)2 OracleMockDriverJdbc3 (com.alibaba.druid.test.util.OracleMockDriverJdbc3)1 ActiveRecordPlugin (com.jfinal.plugin.activerecord.ActiveRecordPlugin)1 MysqlDialect (com.jfinal.plugin.activerecord.dialect.MysqlDialect)1 DruidPlugin (com.jfinal.plugin.druid.DruidPlugin)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 ConditionalOnProperty (org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)1 ConfigurationProperties (org.springframework.boot.context.properties.ConfigurationProperties)1 Primary (org.springframework.context.annotation.Primary)1