panmissl / javamelody

Automatically exported from code.google.com/p/javamelody
1 stars 0 forks source link

Customize styles, icons and other resources in the html reports #196

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
As said in issue 183, it can be helpful to customize styles, icons, effects and 
javascript or help files in the html reports (pdf reports excluded).

For example, the reports could be adapted to the styles of some enterprise 
applications.
And who knows what will be customized?

Original issue reported on code.google.com by evernat@free.fr on 10 Mar 2012 at 11:16

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
A servlet filter has been added in trunk of svn (revision 2604):
http://code.google.com/p/javamelody/source/browse/trunk/javamelody-core/src/main
/java/net/bull/javamelody/CustomResourceFilter.java

The doc says: Servlet filter to customize resources in html reports, such as 
css file.
For example, add the following, before the monitoring filter, in the web.xml 
file of your webapp, in order to use your own css or icons: 

 <filter>
    <filter-name>customResourceFilter</filter-name>
    <filter-class>net.bull.javamelody.CustomResourceFilter</filter-class>
    <init-param>
        <param-name>monitoring.css</param-name>
        <param-value>/customMonitoring.css</param-value>
    </init-param>
    <init-param>
        <param-name>bullets/green.png</param-name>
        <param-value>/static/bullets/red.png</param-value>
    </init-param>
 </filter>
 <filter-mapping>
    <filter-name>customResourceFilter</filter-name>
    <url-pattern>/monitoring</url-pattern>
 </filter-mapping>

Then add files "customMonitoring.css" and "static/bullets/red.png" at the root 
of the web content in your webapp.

You can replace every web resource in this directory and sub-directories:
http://code.google.com/p/javamelody/source/browse/#svn%2Ftrunk%2Fjavamelody-core
%2Fsrc%2Fmain%2Fresources%2Fnet%2Fbull%2Fjavamelody%2Fresource

If you want to try, you will need the next release (1.36) or the new build from 
the trunk including the fix:
http://javamelody.googlecode.com/files/javamelody-20120311.jar

Original comment by evernat@free.fr on 10 Mar 2012 at 11:40

GoogleCodeExporter commented 8 years ago

Original comment by evernat@free.fr on 10 Mar 2012 at 11:41

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Please submit your best CSS file to the users' group:
http://groups.google.com/group/javamelody

The current CSS is at:
http://code.google.com/p/javamelody/source/browse/trunk/javamelody-core/src/main
/resources/net/bull/javamelody/resource/monitoring.css

Original comment by evernat@free.fr on 11 Mar 2012 at 12:20

GoogleCodeExporter commented 8 years ago
Thank you for the addition of this kind of filter which is a step in the right 
direction.

However, it feels a little bit like a "hack", only redirecting resources to 
some other location.

This solution is also unable to change the colors/layout/size of the RRD graphs 
and to change the layout of the html (e.g. to get rid of the <html><body> tags 
to be able to "inline" the monitoring into some application output stream, e.g. 
from jsps).

Original comment by mineral_...@gmx.de on 15 Mar 2012 at 1:50