replace ad
This commit is contained in:
@@ -4,14 +4,20 @@
|
|||||||
*/
|
*/
|
||||||
package com.jeesite.modules.config.web;
|
package com.jeesite.modules.config.web;
|
||||||
|
|
||||||
|
import com.alibaba.druid.support.http.StatViewServlet;
|
||||||
|
import com.alibaba.druid.support.http.WebStatFilter;
|
||||||
|
import com.alibaba.druid.util.Utils;
|
||||||
|
import com.jeesite.common.web.http.ServletUtils;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import com.alibaba.druid.support.http.StatViewServlet;
|
import javax.servlet.ServletException;
|
||||||
import com.alibaba.druid.support.http.WebStatFilter;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Druid 配置
|
* Druid 配置
|
||||||
@@ -44,7 +50,19 @@ public class DruidStatConfig {
|
|||||||
@Bean
|
@Bean
|
||||||
public ServletRegistrationBean<StatViewServlet> druidServlet() {
|
public ServletRegistrationBean<StatViewServlet> druidServlet() {
|
||||||
ServletRegistrationBean<StatViewServlet> bean = new ServletRegistrationBean<>();
|
ServletRegistrationBean<StatViewServlet> bean = new ServletRegistrationBean<>();
|
||||||
bean.setServlet(new StatViewServlet());
|
bean.setServlet(new StatViewServlet(){
|
||||||
|
@Override
|
||||||
|
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
String requestURI = request.getRequestURI();
|
||||||
|
if (requestURI.endsWith("/druid/js/common.js")) {
|
||||||
|
String text = Utils.readFromResource("support/http/resources/js/common.js");
|
||||||
|
text = text.replaceAll("<a.*?banner\"></a><br/>", "JeeSite 数据监控, ");
|
||||||
|
ServletUtils.renderString(response, text, "text/javascript;charset=UTF-8");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.service(request, response);
|
||||||
|
}
|
||||||
|
});
|
||||||
bean.addUrlMappings("/druid/*");
|
bean.addUrlMappings("/druid/*");
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user