将HTTP和DNS配置的自定义域参数的key提取到配置文件中

Signed-off-by: zhangwei <zhangwei@intranet.com>
This commit is contained in:
zhangwei
2018-07-10 09:39:00 +08:00
parent bdc2a88d5b
commit 6c3e8c2375
4 changed files with 41 additions and 10 deletions

View File

@@ -429,4 +429,19 @@ public final class Constants {
public static final String DIGEST_FILE_TYPE = Configurations.getStringProperty("digest_file_type","");
public static final long DIGEST_SINGLE_FILE_MAX_SIZE = Configurations.getLongProperty("digest_single_file_max_size",10485760l);//10M
public static final long DIGEST_TOTAL_FILE_MAX_SIZE = Configurations.getLongProperty("digest_total_file_max_size",52428800l);//50M
//YSP文件特征配置相关参数用于调用外部程序生成特征文件时使用
public static final String AV_FILE_PATH = Configurations.getStringProperty("av_file_path", "/home/ysp/");
public static final String AV_SAMPLE_AUDIO_REGION = Configurations.getStringProperty("av_sample_audio_region", "av_sample_audio");
public static final String AV_SAMPLE_VEDIO_REGION = Configurations.getStringProperty("av_sample_vedio_region", "av_sample_vedio");
public static final String AV_SAMPLE_PITURE_REGION = Configurations.getStringProperty("av_sample_pitrue_region", "av_sample_pitrue");
public static final String AV_SAMPLE_VOIP_REGION = Configurations.getStringProperty("av_sample_voip_region", "av_sample_voip");
public static final String AUDIO_SAMPLE_CREATE_PROC = Configurations.getStringProperty("audio_sample_create_proc", "./audio_convert_proc");
public static final String VEDIO_SAMPLE_CREATE_PROC = Configurations.getStringProperty("vedio_sample_create_proc", "./vedio_convert_proc");
public static final String PICTURE_SAMPLE_CREATE_PROC = Configurations.getStringProperty("picture_sample_create_proc", "./picture_convert_proc");
//HTTP自定义域相关参数
public static String HTTP_HEADER_USER_REGION_KEY=Configurations.getStringProperty("http_header_user_region_key", "HTTP_HEADER");
public static String HTTP_HEADER_DICT_MODULE=Configurations.getStringProperty("http_header_dict_module", "REQUEST_HEADER_DISTRICT");
//DNS自定义域参数
public static String DNS_STRATEGY_USER_REGION_KEY=Configurations.getStringProperty("dns_strategy_user_region_key", "DNS_STRATEGY");
}

View File

@@ -421,12 +421,12 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
//请求头域
if(entity.getHttpReqHdrList()!=null && entity.getHttpReqHdrList().size()>0){
for(ComplexkeywordCfg head:entity.getHttpReqHdrList()){
String dictValue = DictUtils.getDictCode("REQUEST_HEADER_DISTRICT", head.getDistrict());
String dictValue = DictUtils.getDictCode(Constants.HTTP_HEADER_DICT_MODULE, head.getDistrict());
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
if(userRegion.equals("")){
userRegion += "HTTP_HEADER="+head.getDistrict();
userRegion += Constants.HTTP_HEADER_USER_REGION_KEY+"="+head.getDistrict();
}else{
userRegion += Constants.USER_REGION_SPLIT+"HTTP_HEADER="+head.getDistrict();
userRegion += Constants.USER_REGION_SPLIT+Constants.HTTP_HEADER_USER_REGION_KEY+"="+head.getDistrict();
}
}
@@ -435,12 +435,12 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
//应答头域
if(entity.getHttpResHdrList()!=null && entity.getHttpResHdrList().size()>0){
for(ComplexkeywordCfg head:entity.getHttpResHdrList()){
String dictValue = DictUtils.getDictCode("RESPONSE_HEADER_DISTRICT", head.getDistrict());
String dictValue = DictUtils.getDictCode(Constants.HTTP_HEADER_DICT_MODULE, head.getDistrict());
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
if(userRegion.equals("")){
userRegion += "HTTP_HEADER="+head.getDistrict();
userRegion += Constants.HTTP_HEADER_USER_REGION_KEY+"="+head.getDistrict();
}else{
userRegion += Constants.USER_REGION_SPLIT+"HTTP_HEADER="+head.getDistrict();
userRegion += Constants.USER_REGION_SPLIT+Constants.HTTP_HEADER_USER_REGION_KEY+"="+head.getDistrict();
}
}
@@ -905,7 +905,7 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
// dns reject userRegion=;dnsStrategyId;
if(!StringUtil.isEmpty(entity.getDnsStrategyId())){
// maatCfg.setUserRegion(Constants.USER_REGION_SPLIT+entity.getDnsStrategyId()+Constants.USER_REGION_SPLIT);
maatCfg.setUserRegion("DNS_STRATEGY="+entity.getDnsStrategyId());
maatCfg.setUserRegion(Constants.DNS_STRATEGY_USER_REGION_KEY+"="+entity.getDnsStrategyId());
}
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);