bachelor-thesis/chapters/thesis/appendix05_servlet.java

29 lines
1 KiB
Java
Raw Normal View History

2024-09-12 23:02:22 +02:00
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();
2024-09-18 00:19:25 +02:00
String ehCache = perfStatistics.getEhCacheManager();
2024-09-12 23:02:22 +02:00
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);
2024-09-18 00:19:25 +02:00
out.print(", \"ehCache\": ");
out.print(ehCache);
2024-09-12 23:02:22 +02:00
out.print(" }");
}
}