public boolean matches(final String urlPath) { for (final DownloadStrategy strategy : strategies.values()) { if (strategy.matches(urlPath)) { log.debug("Matched plugin download strategy: {}", strategy.getClass().getName()); return true; } } return false; }
private DownloadStrategy findStrategy(String url) { for (final DownloadStrategy downloadStrategy : getDownloadStrategies()) { if (downloadStrategy.matches(url)) { return downloadStrategy; } } return null; } }
public void serveFile(final HttpServletRequest request, final HttpServletResponse response) throws DownloadException { for (final DownloadStrategy strategy : strategies.values()) { if (strategy.matches(request.getRequestURI().toLowerCase())) { strategy.serveFile(request, response); return; } } throw new DownloadException( "Found plugin download strategy during matching but not when trying to serve. Enable debug logging for more information."); }