protected Resource getResource(String uri) throws ResourceNotFoundException { String mimeType = getResourceMimeType(uri); if (!resources.containsKey(uri)) { if ("text/css".equals(mimeType)) { resources.put(uri, new StyleResource(getServletContext(), uri, charset, cache, compress)); } else if ("text/javascript".equals(mimeType)) { resources.put(uri, new ScriptResource(getServletContext(), uri, charset, cache, compress)); } else { resources.put(uri, new Resource(getServletContext(), uri, charset, cache)); } } return resources.get(uri); }