学习使用Jwebap来监测程序性能

一:web.xml配置文件 (带注释的)

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
 version="2.5">
 <display-name>chea</display-name>
 <distributable />

 <!-- start 程序性能监测参数配置 -->
 <context-param>
  <param-name>jwebap-config</param-name>
  <param-value>/WEB-INF/jwebap.xml</param-value>
 </context-param>
 <!-- end -->

 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath*:/spring-context.xml</param-value>
 </context-param>
 <filter>
  <filter-name>encodingFilter</filter-name>
  <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  <init-param>
   <param-name>encoding</param-name>
   <param-value>UTF-8</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>encodingFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <filter>
  <filter-name>JspFilter</filter-name>
  <filter-class>com.easybiz.ssi.web.filter.JspFilter</filter-class>
  <init-param>
   <param-name>allowedJsp</param-name>
   <param-value>/default.jsp,/timeout.jsp,/403.jsp,/404.jsp,/500.jsp,/daoException.jsp</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>JspFilter</filter-name>
  <url-pattern>*.jsp</url-pattern>
 </filter-mapping>
 <filter>
  <filter-name>managerFilter</filter-name>
  <filter-class>com.easybiz.ssi.web.filter.SimpleAuthenticateFilter</filter-class>
  <init-param>
   <param-name>sessionKey</param-name>
   <param-value>user_info</param-value>
  </init-param>
  <init-param>
   <param-name>userType</param-name>
   <param-value>9</param-value>
  </init-param>
  <init-param>
   <param-name>loginPage</param-name>
   <param-value>/admin/timeout.jsp</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>managerFilter</filter-name>
  <url-pattern>/admin/manager/*</url-pattern>
 </filter-mapping>
 <filter>
  <filter-name>individualFilter</filter-name>
  <filter-class>com.easybiz.ssi.web.filter.SimpleAuthenticateFilter</filter-class>
  <init-param>
   <param-name>sessionKey</param-name>
   <param-value>user_info</param-value>
  </init-param>
  <init-param>
   <param-name>userType</param-name>
   <param-value>0</param-value>
  </init-param>
  <init-param>
   <param-name>loginPage</param-name>
   <param-value>/Register/timeout.jsp</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>individualFilter</filter-name>
  <url-pattern>/individual/*</url-pattern>
 </filter-mapping>
 <filter>
  <filter-name>dealerFilter</filter-name>
  <filter-class>com.easybiz.ssi.web.filter.SimpleAuthenticateFilter</filter-class>
  <init-param>
   <param-name>sessionKey</param-name>
   <param-value>user_info</param-value>
  </init-param>
  <init-param>
   <param-name>userType</param-name>
   <param-value>1,2</param-value>
  </init-param>
  <init-param>
   <param-name>loginPage</param-name>
   <param-value>/Register/timeout.jsp</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>dealerFilter</filter-name>
  <url-pattern>/dealer/*</url-pattern>
 </filter-mapping>
 <filter>
  <filter-name>urlRewriteFilter</filter-name>
  <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
  <init-param>
   <param-name>confPath</param-name>
   <param-value>/WEB-INF/config/urlrewrite/urlrewrite.xml</param-value>
  </init-param>
  <init-param>
   <param-name>logLevel</param-name>
   <param-value>WARN</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>urlRewriteFilter</filter-name>
  <url-pattern>/*</url-pattern>
  <dispatcher>REQUEST</dispatcher>
  <dispatcher>FORWARD</dispatcher>
 </filter-mapping>

 <!-- start 程序性能监测,为Tracer插件增加Filter -->
 <filter>
  <filter-name>PageDetectFilter</filter-name>
  <filter-class>org.jwebap.plugin.tracer.http.DetectFilter</filter-class>
  <init-param>
   <param-name>excludeUrls</param-name>
   <param-value>/detect;/detect/*;*.js;*.jpg;*.htm;*.html;*.gif;*.png;*.css;*.swf</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>PageDetectFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <!-- end -->


 <!-- start 建议放在所有listener之前,程序性能监测 -->
 <listener>
  <listener-class>org.jwebap.startup.JwebapListener</listener-class>
 </listener>
 <!-- end -->


 <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>
 <listener>
  <listener-class>com.easybiz.ssi.web.listener.ResourceListener</listener-class>
 </listener>
 <listener>
  <listener-class>com.easybiz.chea.web.listener.BaseDataContextListener</listener-class>
 </listener>
 <listener>
  <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
 </listener>
 <listener>
  <listener-class>com.easybiz.chea.web.listener.TaskManager</listener-class>
 </listener>

 <!-- servlets -->
 <servlet>
  <servlet-name>action</servlet-name>
  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
   <param-name>config</param-name>
   <param-value>/WEB-INF/config/struts/strutsConfig.xml</param-value>
  </init-param>
  <init-param>
   <param-name>config/admin</param-name>
   <param-value>/WEB-INF/config/struts/strutsConfig-manager.xml</param-value>
  </init-param>
  <init-param>
   <param-name>config/channel</param-name>
   <param-value>/WEB-INF/config/struts/strutsConfig-channel.xml</param-value>
  </init-param>
  <init-param>
   <param-name>config/product</param-name>
   <param-value>/WEB-INF/config/struts/strutsConfig-product.xml</param-value>
  </init-param>
  <init-param>
   <param-name>config/individual</param-name>
   <param-value>/WEB-INF/config/struts/strutsConfig-individual.xml</param-value>
  </init-param>
  <init-param>
   <param-name>config/topic</param-name>
   <param-value>/WEB-INF/config/struts/strutsConfig-topic.xml</param-value>
  </init-param>
  <init-param>
   <param-name>config/dealer</param-name>
   <param-value>/WEB-INF/config/struts/strutsConfig-dealer.xml</param-value>
  </init-param>
  <init-param>
   <param-name>debug</param-name>
   <param-value>2</param-value>
  </init-param>
  <init-param>
   <param-name>detail</param-name>
   <param-value>2</param-value>
  </init-param>
  <load-on-startup>2</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
 </servlet-mapping>
 <servlet>
  <servlet-name>Connector</servlet-name>
  <servlet-class>net.fckeditor.connector.ConnectorServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>Connector</servlet-name>
  <url-pattern>/commons/fckeditor/editor/filemanager/connectors/*</url-pattern>
 </servlet-mapping>
 <servlet>
  <servlet-name>VerificationCode</servlet-name>
  <servlet-class>com.easybiz.ssi.web.servlet.VerificationCodeServlet</servlet-class>
  <init-param>
   <param-name>codeType</param-name>
   <param-value>0</param-value>
  </init-param>
 </servlet>
 <servlet-mapping>
  <servlet-name>VerificationCode</servlet-name>
  <url-pattern>/images/VerificationCode.jpg</url-pattern>
 </servlet-mapping>
 
 <!-- start 程序性能监测,增加Jwebap控制台Servlet -->
 <servlet>
  <servlet-name>detect</servlet-name>
  <servlet-class>org.jwebap.ui.controler.JwebapServlet</servlet-class> 
 </servlet>
 <servlet-mapping>
  <servlet-name>detect</servlet-name>
  <url-pattern>/detect/*</url-pattern>
 </servlet-mapping>
 <!-- end -->
 
 
 <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>default.jsp</welcome-file>
 </welcome-file-list>
 <jsp-config>
  <jsp-property-group>
   <url-pattern>*.jsp</url-pattern>
   <scripting-invalid>true</scripting-invalid>
  </jsp-property-group>
 </jsp-config>

</web-app>

 

二:添加bin包以及lib包中的jar到项目,复制jwebap.xml到WEB-INF下。

 

三:启动程序,并配置参数(点击左边plugins-->Tracer)

配置JdbcComponent 时,driver-clazzs最好写数据源,如:org.apache.commons.dbcp.BasicDataSource

四:重启程序即可。。。。。。。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值