test_class.declarator: context = new SlingContext()
test_class.modifier: @Rule
      public final
test_class.original_string: @Rule
      public final SlingContext context = new SlingContext();
test_class.type: SlingContext
test_class.var_name: context
test_class.file: core/src/test/java/org/apache/sling/cms/core/internal/servlets/DownloadFileServletTest.java
test_class.identifier: DownloadFileServletTest
test_case.body: @Test
      public void testValidRequest() throws ServletException, IOException {
  
          context.requestPathInfo().setSuffix("/content/apache/sling-apache-org/index/apache.png");
  
          DownloadFileServlet dfs = new DownloadFileServlet();
  
          dfs.doGet(context.request(), context.response());
  
          assertEquals(200, context.response().getStatus());
          assertTrue(context.response().getHeaderNames().contains("Content-Disposition"));
      }
test_case.class_method_signature: DownloadFileServletTest.testValidRequest()
test_case.full_signature: @Test public void testValidRequest()
test_case.identifier: testValidRequest
test_case.invocations: setSuffix requestPathInfo doGet request response assertEquals getStatus response assertTrue contains getHeaderNames response
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidRequest()
focal_class.declarator: serialVersionUID = 6234007100684499058L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = 6234007100684499058L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.file: core/src/main/java/org/apache/sling/cms/core/internal/servlets/DownloadFileServlet.java
focal_class.identifier: DownloadFileServlet
focal_class.class_method_signature: DownloadFileServlet.doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
focal_class.full_signature: @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
focal_class.identifier: doGet
focal_class.modifiers: @Override protected
focal_class.parameters: (SlingHttpServletRequest request, SlingHttpServletResponse response)
focal_class.return: void
focal_class.signature: void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
focal_class.superclass: extends SlingSafeMethodsServlet
focal_method.body: @Override
      protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
              throws ServletException, IOException {
          Resource suffixResource = request.getRequestPathInfo().getSuffixResource();
          if (suffixResource != null) {
              response.setContentType(suffixResource.getValueMap().get("jcr:content/jcr:mimeType", ""));
              response.setHeader("Content-Disposition", "attachment; " + suffixResource.getName());
              IOUtils.copy(suffixResource.adaptTo(InputStream.class), response.getOutputStream());
          } else {
              response.sendError(404);
          }
      }
focal_method.class_method_signature: DownloadFileServlet.doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
focal_method.full_signature: @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
focal_method.identifier: doGet
focal_method.invocations: getSuffixResource getRequestPathInfo setContentType get getValueMap setHeader getName copy adaptTo getOutputStream sendError
focal_method.modifiers: @Override protected
focal_method.parameters: (SlingHttpServletRequest request, SlingHttpServletResponse response)
focal_method.return: void
focal_method.signature: void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)