public class PerfStatServlet extends HttpServlet {
    private final static Logger m_Logger = Logger.getLogger(PerfStatServlet.class.toString());

    @Inject
    private PerfStatistics perfStatistics;

    public PerfStatServlet() {
        m_Logger.info("PerfStatServlet() Constructor");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String openJPAStatistics = perfStatistics.getOpenJPAStatistics();
        String entityClasses = perfStatistics.getEntityClasses();
        String ehCache = perfStatistics.getEhCacheManager();

        resp.setStatus(HttpServletResponse.SC_OK);
        resp.setContentType(MediaType.APPLICATION_JSON);
        PrintWriter out = resp.getWriter();
        out.print("{ \"openJPAStatistics\": ");
        out.print(openJPAStatistics);
        out.print(", \"entityClasses\": ");
        out.print(entityClasses);
        out.print(", \"ehCache\": ");
        out.print(ehCache);
        out.print(" }");
    }
}
