public void serveResource(HttpServletRequest request, HttpServletResponse response) throws DownloadException { try { String type = getContentType(); if (StringUtils.isNotBlank(type)) { response.setContentType(type); // this will be used if content-type is not set by the forward handler, e.g. for webapp content in Tomcat } request.getRequestDispatcher(getLocation()).forward(request, response); } catch (ServletException | IOException e) { throw new DownloadException(e.getMessage()); } }