protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { setResponseHeaders(request, response); } catch (NotFoundException nfe) { response.sendError(HttpServletResponse.SC_NOT_FOUND, nfe.getMessage()); } response.setStatus(HttpServletResponse.SC_OK); } }
protected File getFileName(HttpServletRequest request, HttpServletResponse response) { // Drop leading slash String filename = request.getPathInfo().substring(1); // Check that there are no slashes, we don't permit directories if (filename.contains("/")) { throw new NotFoundException("Sub directories not allowed"); } File logoDirectory = new File(ManagerFactory.getApplicationProperties().getString( APKeys.JIRA_PATH_ATTACHMENTS) + STUDIO_LOGO_PATH_DIR); if (!logoDirectory.exists()) { throw new NotFoundException(); } File logoFile = new File(logoDirectory, filename); if (logoFile.exists()) { return logoFile; } else { throw new NotFoundException(); } }