@Test public void testDoGet_simple_DoNotCache() throws Exception { ClientSpanJavaScriptServlet clientSpanJavaScriptServlet = new ClientSpanJavaScriptServlet(mockServletPluginWithCacheTime(0)); final MockHttpServletRequest request = new MockHttpServletRequest(); final MockHttpServletResponse response = new MockHttpServletResponse(); clientSpanJavaScriptServlet.doGet(request, response); assertThat(response.getContentAsString()).contains("EumObject"); assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getHeader(CACHE_CONTROL)).isEqualTo("no-cache"); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (servletPlugin.isClientSpanCollectionEnabled()) { resp.setHeader(ETAG, javaScriptEtag); resp.setHeader(CACHE_CONTROL, getCacheControlMaxAge()); if (isInClientCache(req)) { resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { resp.setContentType(MIME_APPLICATION_JAVASCRIPT); resp.getWriter().write(javaScript); } } else { log.debug("Client span collection is disabled"); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } }
ClientSpanJavaScriptServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (servletPlugin.isClientSpanCollectionEnabled()) { resp.setHeader(ETAG, javaScriptEtag); resp.setHeader(CACHE_CONTROL, getCacheControlMaxAge()); if (isInClientCache(req)) { resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { resp.setContentType(MIME_APPLICATION_JAVASCRIPT); resp.getWriter().write(javaScript); } } else { log.debug("Client span collection is disabled"); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } } }
ClientSpanJavaScriptServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (servletPlugin.isClientSpanCollectionEnabled()) { resp.setHeader(ETAG, javaScriptEtag); resp.setHeader(CACHE_CONTROL, getCacheControlMaxAge()); if (isInClientCache(req)) { resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { resp.setContentType(MIME_APPLICATION_JAVASCRIPT); resp.getWriter().write(javaScript); } } else { log.debug("Client span collection is disabled"); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } } ClientSpanJavaScriptServlet();  ClientSpanJavaScriptServlet(ServletPlugin servletPlugin); }
ClientSpanJavaScriptServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (servletPlugin.isClientSpanCollectionEnabled()) { resp.setHeader(ETAG, javaScriptEtag); resp.setHeader(CACHE_CONTROL, getCacheControlMaxAge()); if (isInClientCache(req)) { resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { resp.setContentType(MIME_APPLICATION_JAVASCRIPT); resp.getWriter().write(javaScript); } } else { log.debug("Client span collection is disabled"); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } } ClientSpanJavaScriptServlet();  ClientSpanJavaScriptServlet(ServletPlugin servletPlugin); void rebuildJavaScriptAndEtag(); }
ClientSpanJavaScriptServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (servletPlugin.isClientSpanCollectionEnabled()) { resp.setHeader(ETAG, javaScriptEtag); resp.setHeader(CACHE_CONTROL, getCacheControlMaxAge()); if (isInClientCache(req)) { resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { resp.setContentType(MIME_APPLICATION_JAVASCRIPT); resp.getWriter().write(javaScript); } } else { log.debug("Client span collection is disabled"); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } } ClientSpanJavaScriptServlet();  ClientSpanJavaScriptServlet(ServletPlugin servletPlugin); void rebuildJavaScriptAndEtag();  }