This HowTo explains how to integrate MoSKito web user interface into your application. You will need a MoSKito release (Check this HowTo if you don't know where to get it), JDK 1.5 or higher and a 2.3 or higher compliant web container. The MoSKito demowebapp and especially the build file for ant are good examples.
First you'll need to place moskito-core.jar, moskito-web.jar and moskito-webui.jar in the lib directory of your webapp (WEB-INF/lib) or into shared libs if your container supports them ($CATALINA_HOME/shared/lib for tomcat). You will also need ano-util.jar and log4j-1.2.8.jar (or higher) at same location. All those libs are provided by the moskito distribution you downloaded. Since moskito uses struts you will need a struts distribution. Struts 1.2.9 is included into moskito release.
After you copied the libs, you will have to place the JSP- and config files into your application. The JSPs are packed together into moskito-webui-jsps.jar archive, unpacking this archive into the root directory of your application will be sufficent. This can be solved with ant very simply:
<unjar src="${lib}/moskito-webui-jsps.jar" dest="${webapp.root.dir}"/>
<unjar src="${lib}/moskito-webui-config.jar" dest="${webapp.root.dir}/WEB-INF/classes"/>
This jar contains the struts-config for the moskito web-ui.
After you put the puzzle together you have to modify your web.xml.
First you'll need a mapping to the MoskitoUI Servlet. Note, if you already use struts in your web-app, adding /WEB-INF/classes/struts-config-moskito.xml to your comma separated list of struts-config files is sufficent. Otherwise you need following in your web.xml:
<servlet>
<servlet-name>moskitoUI</servlet-name>
<servlet-class>net.java.dev.moskito.webui.MoskitoUIServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/classes/struts-config-moskito.xml,
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- other servlet declarations -->
<servlet-mapping>
<servlet-name>moskitoUI</servlet-name>
<url-pattern>/mui/*</url-pattern>
</servlet-mapping>
And of course you can select your own mapping.
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
</taglib>
Again, for a 2.4 compliant web.xml you have to surround the above fragment with <jsp-config> tag.
<filter>
<filter-name>DomainFilter</filter-name>
<filter-class>net.java.dev.moskito.web.filters.DomainFilter</filter-class>
<init-param>
<param-name>limit</param-name>
<param-value>XXX</param-value>
</init-param>
</filter>
<filter>
<filter-name>UserAgentFilter</filter-name>
<filter-class>net.java.dev.moskito.web.filters.UserAgentFilter</filter-class>
<init-param>
<param-name>limit</param-name>
<param-value>XXX</param-value>
</init-param>
</filter>
<filter>
<filter-name>RefererFilter</filter-name>
<filter-class>net.java.dev.moskito.web.filters.RefererFilter</filter-class>
<init-param>
<param-name>limit</param-name>
<param-value>XXX</param-value>
</init-param>
</filter>
<filter>
<filter-name>RequestURIFilter</filter-name>
<filter-class>net.java.dev.moskito.web.filters.RequestURIFilter</filter-class>
<init-param>
<param-name>limit</param-name>
<param-value>XXX</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>DomainFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>RequestURIFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>UserAgentFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>RefererFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Note: since the filters are working with stats on demand, limiting them according to your memory settings and predicted units is important for preventing a memory leakage. 100 will be the best value for begginers.
Now you are really done. Enjoy your stats under /<context>/mui/mskShowAllProducers.