Enabling/Disabling Profiling

Profiling is not enabled by default, because it incurs a small (less than 1%) performance penalty. You can turn profiling on by setting the application scope attribute neo.util.servlet.RequestInfo.StatisticsSource as follows:

<% 
 pageContext.getServletContext().setAttribute("neo.util.servlet.RequestInfo.StatisticsSource",
  neo.nursery.GlobalBus.lookupSafe("/neo/io/reports/ReportsStatisticsSource")); 
%>

To turn profiling off again, simply remove the attribute as follows:

<% 
 pageContext.getServletContext().removeAttribute("neo.util.servlet.RequestInfo.StatisticsSource"); 
%>

You want to be able to turn profiling on and off at will during template development without exposing the option to users of the publication. A simple way of doing this is to add two JSP files containing these commands to your application: profiling-on.jsp and profiling-off.jsp, for example. You can then easily turn profiling on and off by navigating to these files in your browser. To turn profiling on, for example, you would enter something like this in your browser's address field:

http://server-name:port/publication/template/profiling-on.jsp

and something like this to turn it off again:

http://server-name:port/publication/template/profiling-off.jsp

where publication is the name of your publication.