@@ -0,0 +1,1873 @@
+package net.kencochrane.raven.sentrystub;%0A%0Aimport com.fasterxml.jackson.core.JsonFactory;%0Aimport com.fasterxml.jackson.core.JsonGenerator;%0A%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.annotation.WebServlet;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.io.IOException;%0A%0A/**%0A * Simple API to access the sentry stub details.%0A */%0A@WebServlet(name = %22SentryStubServlet%22, displayName = %22SentryStubServlet%22, urlPatterns = %22/stub/*%22)%0Apublic class SentryStubServlet extends HttpServlet %7B%0A    private static final String COUNT_OPERATION = %22count%22;%0A    private static final String CLEANUP_OPERATION = %22cleanup%22;%0A    private SentryStub sentryStub = SentryStub.getInstance();%0A    private JsonFactory jsonFactory = new JsonFactory();%0A%0A    public void getEventsCounter(JsonGenerator generator) throws IOException %7B%0A        generator.writeStartObject();%0A        generator.writeNumberField(%22count%22, sentryStub.getEvents().size());%0A        generator.writeEndObject();%0A    %7D%0A%0A    @Override%0A    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException %7B%0A        String operation = req.getPathInfo().substring(1);%0A%0A        JsonGenerator jsonGenerator = jsonFactory.createGenerator(resp.getOutputStream());%0A%0A        if (COUNT_OPERATION.equals(operation)) %7B%0A            getEventsCounter(jsonGenerator);%0A        %7D else %7B%0A            resp.setStatus(HttpServletResponse.SC_NOT_FOUND);%0A        %7D%0A%0A        jsonGenerator.close();%0A    %7D%0A%0A    @Override%0A    protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException %7B%0A        String operation = req.getPathInfo().substring(1);%0A%0A        if (CLEANUP_OPERATION.equals(operation)) %7B%0A            sentryStub.removeEvents();%0A        %7D%0A    %7D%0A%7D%0A

Create a servlet to access the details of sentry stub