HTTP替换业务转换空格和斜杠
修改HTTP 业务下删除ip表sql(去掉protocolId条件)
This commit is contained in:
@@ -226,7 +226,9 @@
|
|||||||
<if test="ipPort!=null">
|
<if test="ipPort!=null">
|
||||||
AND a.compile_id in (select t.compile_id from ip_port_cfg t
|
AND a.compile_id in (select t.compile_id from ip_port_cfg t
|
||||||
<where>
|
<where>
|
||||||
and t.protocol_id=4
|
<if test="functionId != null">
|
||||||
|
AND t.function_id=#{functionId,jdbcType=INTEGER}
|
||||||
|
</if>
|
||||||
<if test="ipPort.srcIpAddress != null and ipPort.srcIpAddress != ''">
|
<if test="ipPort.srcIpAddress != null and ipPort.srcIpAddress != ''">
|
||||||
and t.src_ip_address =#{(ipPort.srcIpAddress,jdbcType=VARCHAR}
|
and t.src_ip_address =#{(ipPort.srcIpAddress,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
@@ -857,7 +859,7 @@
|
|||||||
</update>
|
</update>
|
||||||
<!-- 删除http子配置 -->
|
<!-- 删除http子配置 -->
|
||||||
<delete id="deleteHttpIpCfg" >
|
<delete id="deleteHttpIpCfg" >
|
||||||
delete from ip_port_cfg where compile_id=#{compileId} and protocol_id=4 and function_id=#{functionId}
|
delete from ip_port_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||||
</delete>
|
</delete>
|
||||||
<delete id="deleteHttpUrlCfg">
|
<delete id="deleteHttpUrlCfg">
|
||||||
delete from http_url_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
delete from http_url_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||||
|
|||||||
@@ -593,4 +593,13 @@ public abstract class BaseService {
|
|||||||
}
|
}
|
||||||
return cfgKeywords;
|
return cfgKeywords;
|
||||||
}
|
}
|
||||||
|
public static String replaceContentEscape(String replaceContent){
|
||||||
|
if(StringUtils.isNotEmpty(replaceContent)){
|
||||||
|
//不转译特殊字符
|
||||||
|
replaceContent = replaceContent.trim();//首先去掉首尾空格
|
||||||
|
replaceContent=replaceContent.replace("/", "\\/");
|
||||||
|
replaceContent=replaceContent.replace(" ", "\\b");
|
||||||
|
}
|
||||||
|
return replaceContent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
@@ -414,21 +415,52 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
|||||||
Constants.REDIRECT_CONTENT_KEY+"="+entity.getUserRegion2();
|
Constants.REDIRECT_CONTENT_KEY+"="+entity.getUserRegion2();
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
if(!StringUtil.isEmpty(entity.getUserRegion1())){
|
//HTTP block
|
||||||
userRegion=userRegion+"userRegion1="+entity.getUserRegion1();
|
if(entity.getAction().equals(16)){
|
||||||
|
if(!StringUtil.isEmpty(entity.getUserRegion1())){
|
||||||
|
userRegion=Constants.REDIRECT_RESPONSE_CODE_KEY+"="+entity.getUserRegion1();
|
||||||
|
}
|
||||||
|
if(!StringUtil.isEmpty(entity.getUserRegion2())){
|
||||||
|
userRegion=userRegion+";"+Constants.REDIRECT_CONTENT_KEY+"="+entity.getUserRegion2();
|
||||||
|
}else{
|
||||||
|
userRegion="";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!StringUtil.isEmpty(entity.getUserRegion2())){
|
//HTTP redirect
|
||||||
userRegion=userRegion+";userRegion2="+entity.getUserRegion2();
|
if(entity.getAction().equals(48)){
|
||||||
|
if(!StringUtil.isEmpty(entity.getUserRegion1())){
|
||||||
|
userRegion=Constants.REDIRECT_RESPONSE_CODE_KEY+"="+entity.getUserRegion1();
|
||||||
|
}
|
||||||
|
if(!StringUtil.isEmpty(entity.getUserRegion2())){
|
||||||
|
userRegion=userRegion+";"+Constants.REDIRECT_URL_KEY+"="+entity.getUserRegion2();
|
||||||
|
}else{
|
||||||
|
userRegion="";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!StringUtil.isEmpty(entity.getUserRegion3())){
|
//HTTP replace
|
||||||
userRegion=userRegion+";userRegion3="+entity.getUserRegion3();
|
if(entity.getAction().equals(80)){
|
||||||
}
|
if(!StringUtil.isEmpty(entity.getUserRegion1())){
|
||||||
if(!StringUtil.isEmpty(entity.getUserRegion4())){
|
userRegion=Constants.REPLACE_ZONE_KEY+"="+entity.getUserRegion1();
|
||||||
userRegion=userRegion+";userRegion4="+entity.getUserRegion4();
|
}
|
||||||
}
|
String substitute="";
|
||||||
if(!StringUtil.isEmpty(entity.getUserRegion5())){
|
if(!StringUtil.isEmpty(entity.getUserRegion2())){
|
||||||
userRegion=userRegion+";userRegion5="+entity.getUserRegion5();
|
String userRegion2=entity.getUserRegion2();
|
||||||
|
substitute="/";
|
||||||
|
userRegion2 = BaseService.replaceContentEscape(userRegion2);
|
||||||
|
substitute=substitute+userRegion2;
|
||||||
|
}
|
||||||
|
if(!StringUtil.isEmpty(entity.getUserRegion3())){
|
||||||
|
String userRegion3=entity.getUserRegion3();
|
||||||
|
userRegion3 = BaseService.replaceContentEscape(userRegion3);
|
||||||
|
substitute=substitute+"/"+userRegion3;
|
||||||
|
}
|
||||||
|
if(StringUtil.isEmpty(substitute)){
|
||||||
|
userRegion="";
|
||||||
|
}else{
|
||||||
|
userRegion=userRegion+";"+Constants.REPLACE_SUBSTITUTE_KEY+"="+substitute;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maatCfg.setUserRegion(userRegion);
|
maatCfg.setUserRegion(userRegion);
|
||||||
configCompileList.add(maatCfg);
|
configCompileList.add(maatCfg);
|
||||||
maatBean.setConfigCompileList(configCompileList);
|
maatBean.setConfigCompileList(configCompileList);
|
||||||
|
|||||||
@@ -890,6 +890,7 @@ response_code=Response Code
|
|||||||
response_content=Response Content
|
response_content=Response Content
|
||||||
not_found=Not Found
|
not_found=Not Found
|
||||||
silent=Silent
|
silent=Silent
|
||||||
|
action_region=Action Region
|
||||||
redirect_response_code=Redirect Response Code
|
redirect_response_code=Redirect Response Code
|
||||||
redirect_url=Redirect URL
|
redirect_url=Redirect URL
|
||||||
replace_zone=Replace Zone
|
replace_zone=Replace Zone
|
||||||
|
|||||||
@@ -892,6 +892,7 @@ response_code=\u5E94\u7B54\u7801
|
|||||||
response_content=\u54CD\u5E94\u5185\u5BB9
|
response_content=\u54CD\u5E94\u5185\u5BB9
|
||||||
not_found=\u4E0D\u5B58\u5728
|
not_found=\u4E0D\u5B58\u5728
|
||||||
silent=\u5173\u95ED
|
silent=\u5173\u95ED
|
||||||
|
action_region=\u52A8\u4F5C\u89C4\u5219
|
||||||
redirect_response_code=\u91CD\u5B9A\u5411\u5E94\u7B54\u7801
|
redirect_response_code=\u91CD\u5B9A\u5411\u5E94\u7B54\u7801
|
||||||
redirect_url=\u91CD\u5B9A\u5411URL
|
redirect_url=\u91CD\u5B9A\u5411URL
|
||||||
replace_zone=\u66FF\u6362\u533A\u57DF
|
replace_zone=\u66FF\u6362\u533A\u57DF
|
||||||
|
|||||||
Reference in New Issue
Block a user