Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String requestPath = request.getPathInfo(); String pluginName, requestFilePath; final String slash = "/"; requestPath = requestPath == null ? slash : requestPath; requestPath = requestPath.startsWith(slash) ? requestPath.substring(1) : requestPath; String[] parts = requestPath.split(slash, 2); if (parts.length == 2 && !parts[0].trim().isEmpty() && !parts[1].trim().isEmpty()) { pluginName = parts[0]; requestFilePath = parts[1]; } else { logger.error("Missing UI plugin name and/or relative file path for request [" + request.getRequestURI() + "]"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } PluginData pluginData = getPluginData(pluginName); if (pluginData == null) { logger.error("No data available for UI plugin [" + pluginName + "]"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } else if (pluginData.getResourcePath() == null) { logger.error("Local resource path not specified for UI plugin [" + pluginName + "]"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } String filePath = pluginData.getResourcePath() + File.separator + requestFilePath; if (!ServletUtils.isSane(filePath)) { logger.error("Requested file path [" + filePath + "] is not sane"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } File file = new File(baseDir, filePath); if (file.isDirectory()) { logger.error("Requested file path [" + filePath + "] denotes a directory instead of file"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } response.setHeader("Cache-Control", "no-cache"); String mimeType = ServletUtils.getMimeMap().getContentType(file); ServletUtils.sendFile(request, response, file, mimeType); }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String requestPath = request.getPathInfo(); String pluginName, requestFilePath; final String slash = "/"; requestPath = requestPath == null ? slash : requestPath; requestPath = StringUtils.stripStart(requestPath, slash); String[] parts = requestPath.split(slash, 2); if (parts.length == 2 && StringUtils.isNotBlank(parts[0]) && StringUtils.isNotBlank(parts[1])) { pluginName = parts[0]; requestFilePath = parts[1]; } else { logger.error("Missing UI plugin name and/or relative file path for request [" + request.getRequestURI() + "]"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } PluginData pluginData = getPluginData(pluginName); if (pluginData == null) { logger.error("No data available for UI plugin [" + pluginName + "]"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } else if (pluginData.getResourcePath() == null) { logger.error("Local resource path not specified for UI plugin [" + pluginName + "]"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } String filePath = pluginData.getResourcePath() + File.separator + requestFilePath; if (!ServletUtils.isSane(filePath)) { logger.error("Requested file path [" + filePath + "] is not sane"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } File file = new File(baseDir, filePath); if (file.isDirectory()) { logger.error("Requested file path [" + filePath + "] denotes a directory instead of file"); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } response.setHeader("Cache-Control", "no-cache"); String mimeType = ServletUtils.getMimeMap().getContentType(file); ServletUtils.sendFile(request, response, file, mimeType); }