HTTP重定向业务增加自定义域信息
This commit is contained in:
@@ -31,6 +31,11 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
protected String showName;//表在界面上展示的名称
|
||||
protected String seltype;//选中类型,页面搜索用
|
||||
protected String tableName;
|
||||
protected String userRegion1;
|
||||
protected String userRegion2;
|
||||
protected String userRegion3;
|
||||
protected String userRegion4;
|
||||
protected String userRegion5;
|
||||
/**
|
||||
* 编译id
|
||||
*/
|
||||
@@ -786,4 +791,35 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
public void setAreaType(Integer areaType) {
|
||||
this.areaType = areaType;
|
||||
}
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
public void setUserRegion2(String userRegion2) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
public String getUserRegion3() {
|
||||
return userRegion3;
|
||||
}
|
||||
public void setUserRegion3(String userRegion3) {
|
||||
this.userRegion3 = userRegion3;
|
||||
}
|
||||
public String getUserRegion4() {
|
||||
return userRegion4;
|
||||
}
|
||||
public void setUserRegion4(String userRegion4) {
|
||||
this.userRegion4 = userRegion4;
|
||||
}
|
||||
public String getUserRegion5() {
|
||||
return userRegion5;
|
||||
}
|
||||
public void setUserRegion5(String userRegion5) {
|
||||
this.userRegion5 = userRegion5;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -404,4 +404,8 @@ public final class Constants {
|
||||
public static final String HTTP_REDIRECT_RES_HEAD_REGION = Configurations.getStringProperty("http_redirect_res_hdr_region","PXY_CTRL_HTTP_RES_HDR");
|
||||
public static final String HTTP_REDIRECT_REQ_BODY_REGION = Configurations.getStringProperty("http_redirect_req_body_region","PXY_CTRL_HTTP_REQ_BODY");
|
||||
public static final String HTTP_REDIRECT_RES_BODY_REGION = Configurations.getStringProperty("http_redirect_res_body_region","PXY_CTRL_HTTP_RES_BODY");
|
||||
public static final String REDIRECT_RESPONSE_CODE_KEY = Configurations.getStringProperty("redirect_response_code_key","code");
|
||||
public static final String REDIRECT_URL_KEY = Configurations.getStringProperty("redirect_url_key","url");
|
||||
public static final String REDIRECT_CONTENT_KEY = Configurations.getStringProperty("redirect_content_key","content");
|
||||
public static final String REDIRECT_RESPONSE_CODE_STARTWITH = Configurations.getStringProperty("redirect_response_code_startwith","30");
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
|
||||
<result column="dns_strategy_name" property="dnsStrategyName" jdbcType="VARCHAR" />
|
||||
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
@@ -123,7 +128,8 @@
|
||||
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
|
||||
a.user_region2,a.user_region3,a.user_region4,a.user_region5
|
||||
</sql>
|
||||
<sql id="IpCfg_Column" >
|
||||
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
|
||||
@@ -392,7 +398,12 @@
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
dns_strategy_id
|
||||
dns_strategy_id,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -413,7 +424,12 @@
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{dnsStrategyId,jdbcType=INTEGER}
|
||||
#{dnsStrategyId,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<!-- insert ip_port_cfg表信息 -->
|
||||
@@ -518,7 +534,12 @@
|
||||
cfg_region_code,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin
|
||||
is_hexbin,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -545,7 +566,12 @@
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER}
|
||||
#{isHexbin,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -580,7 +606,12 @@
|
||||
cfg_region_code,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin
|
||||
is_hexbin,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -607,7 +638,12 @@
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER}
|
||||
#{isHexbin,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -641,7 +677,12 @@
|
||||
cfg_region_code,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin
|
||||
is_hexbin,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -667,7 +708,12 @@
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER}
|
||||
#{isHexbin,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<!-- insert http_url_cfg表信息 -->
|
||||
@@ -700,7 +746,12 @@
|
||||
cfg_region_code,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin
|
||||
is_hexbin,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -726,7 +777,12 @@
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER}
|
||||
#{isHexbin,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<update id="updateCfgIndex" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
@@ -778,6 +834,21 @@
|
||||
</if>
|
||||
<if test="functionId != null" >
|
||||
function_id = #{functionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="userRegion1 != null and userRegion1 != ''" >
|
||||
user_region1 = #{userRegion1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion2 != null and userRegion2 != ''" >
|
||||
user_region2 = #{userRegion2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion3 != null and userRegion3 != ''" >
|
||||
user_region3 = #{userRegion3,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion4 != null and userRegion4 != ''" >
|
||||
user_region4 = #{userRegion4,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion5 != null and userRegion5 != ''" >
|
||||
user_region5 = #{userRegion5,jdbcType=VARCHAR},
|
||||
</if>
|
||||
dns_strategy_id = #{dnsStrategyId,jdbcType=INTEGER},
|
||||
</trim>
|
||||
|
||||
@@ -366,40 +366,19 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
|
||||
//判断http配置是否需要设置自定义域参数
|
||||
String actionValue = DictUtils.getDictCode("SERVICE_ACTION", "action_monit");
|
||||
String userRegion = "";
|
||||
//只有监测业务,并且头域的匹配区域不匹配字典中的信息时需要设置
|
||||
if(!actionValue.equals("默认") && entity.getAction().equals(Integer.parseInt(actionValue))){
|
||||
//请求头域
|
||||
if(entity.getHttpReqHdrList()!=null && entity.getHttpReqHdrList().size()>0){
|
||||
for(ComplexkeywordCfg head:entity.getHttpReqHdrList()){
|
||||
String dictValue = DictUtils.getDictCode("REQUEST_HEADER_DISTRICT", head.getDistrict());
|
||||
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
|
||||
if(userRegion.equals("")){
|
||||
userRegion += "HTTP_HEADER="+head.getDistrict();
|
||||
}else{
|
||||
userRegion += Constants.USER_REGION_SPLIT+"HTTP_HEADER="+head.getDistrict();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(entity.getUserRegion1())){
|
||||
if(entity.getUserRegion1().startsWith(Constants.REDIRECT_RESPONSE_CODE_STARTWITH)){
|
||||
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+entity.getUserRegion1()+
|
||||
Constants.USER_REGION_SPLIT+
|
||||
Constants.REDIRECT_URL_KEY+"="+entity.getUserRegion2();
|
||||
}else{
|
||||
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+entity.getUserRegion1()+
|
||||
Constants.USER_REGION_SPLIT+
|
||||
Constants.REDIRECT_CONTENT_KEY+"="+entity.getUserRegion2();
|
||||
}
|
||||
//应答头域
|
||||
if(entity.getHttpResHdrList()!=null && entity.getHttpResHdrList().size()>0){
|
||||
for(ComplexkeywordCfg head:entity.getHttpResHdrList()){
|
||||
String dictValue = DictUtils.getDictCode("RESPONSE_HEADER_DISTRICT", head.getDistrict());
|
||||
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
|
||||
if(userRegion.equals("")){
|
||||
userRegion += "HTTP_HEADER="+head.getDistrict();
|
||||
}else{
|
||||
userRegion += Constants.USER_REGION_SPLIT+"HTTP_HEADER="+head.getDistrict();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
|
||||
Reference in New Issue
Block a user