Instrumenting a Java-based Web Site / Web Application

As already mentioned, you can use the egrum.jar file that eG Enterprise provides to instrument a Java-based web site/web application that uses server side templates to auto-generate the common section. To perform this instrumentation, do the following:

  1. First, download the egrum.jar to the system hosting the web application. For this, click the Download button alongside egrum.jar in Figure 3.
  2. Once the download is complete, make sure that the egrum.jar is included in the class path of the target web application. If you are using an IDE, copy it into your build project and make sure it's accessible in your runtime classpath.
  3. Next, open the template that auto-generates the common section, in an editor. In the header of the template, insert the code that imports the helper class – – into the template, as shown below:

    <%@ page language="java" contentType="text/html" import=";" %>


    This helper class will automatically inject the JavaScript code snippet into the template.

  4. To expose the output of the RUMHandler method, insert the line of code shown below, just after any <meta> tags in your <head> block. Note that this code should be the first non-meta tag inside the <head> block.

    <%@ page language="java" contentType="text/html" import=";" %>



    <meta ... >

    <!-- RUMHandler method return strings so you need to expose their output as shown -->

    <% out.println(RUMHandler.getHeader()); %>







  5. Save the edited template and restart the web site/web application being monitored.
  6. Now, test your web application locally and view the page source in your browser. The page markup should include < !-- RUM Header -->.
  7. Repeat steps 3 to 7 above for each server side template that dynamically generates the common section.

Once this is done, then the JavaScript will be auto-injected into each web page that uses the common section, track requests to each of the web pages, and report response time metrics it collects to the RUM collector.