@Override public Resource getResource(String path) { Resource resource = super.getResource(path); if (resource == null) return null; if (!(resource instanceof PathResource) || !resource.exists()) return resource; try { File f = resource.getFile(); if (f.isDirectory() && !path.equals("/")) return resource; CacheResource cache = resourceCache.get(f); if (cache != null) return cache; if (f.length() < CACHE_LIMIT || f.getName().endsWith(".html") || path.equals("/")) { cache = new CacheResource((PathResource) resource); resourceCache.put(f, cache); return cache; } } catch (IOException e) { e.printStackTrace(); } return resource; }
@Override public Resource getResource(String path) { try { Resource resource = super.getResource(path); if (resource == null) return null; if (!(resource instanceof PathResource) || !resource.exists()) return resource; File f = resource.getFile(); if (f.isDirectory() && !path.equals("/")) return resource; CacheResource cache = resourceCache.get(f); if (cache != null) return cache; if (f.length() < CACHE_LIMIT || f.getName().endsWith(".html") || path.equals("/")) { cache = new CacheResource((PathResource) resource); resourceCache.put(f, cache); return cache; } return resource; } catch (IOException e) { Data.logger.warn("", e); } return null; }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(Dispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String)request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String)request.getAttribute(Dispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext=URIUtil.addPaths(servletPath,pathInfo); return getResource(pathInContext); }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(Dispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String)request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String)request.getAttribute(Dispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext=URIUtil.addPaths(servletPath,pathInfo); return getResource(pathInContext); }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext=URIUtil.addPaths(servletPath,pathInfo); return getResource(pathInContext); }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(Dispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String)request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String)request.getAttribute(Dispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext=URIUtil.addPaths(servletPath,pathInfo); return getResource(pathInContext); }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(Dispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String)request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String)request.getAttribute(Dispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext=URIUtil.addPaths(servletPath,pathInfo); return getResource(pathInContext); }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext=URIUtil.addPaths(servletPath,pathInfo); return getResource(pathInContext); }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext=URIUtil.addPaths(servletPath,pathInfo); return getResource(pathInContext); }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext=URIUtil.addPaths(servletPath,pathInfo); return getResource(pathInContext); }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(Dispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String)request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String)request.getAttribute(Dispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext=URIUtil.addPaths(servletPath,pathInfo); return getResource(pathInContext); }
protected Resource getResource(HttpServletRequest request) throws MalformedURLException { System.err.println("getResource uri:" + request.getRequestURI()); // return super.getResource(request); // } // // @Override // public Resource getResource(String path) { // System.err.println("getResource path:" + path); Resource resource = super.getResource(request); if (resource == null || !resource.exists()) { return resource; } String path = request.getRequestURI(); if ("/js/jquery.min.js".equals(path)) { try { resource = this.append(request, resource, path); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } return resource; }
@Override public String getWelcomeFile(String pathInContext) { if (_welcomes == null) return null; for (int i = 0; i < _welcomes.length; i++) { String welcome_in_context = URIUtil.addPaths(pathInContext,_welcomes[i]); Resource welcome = getResource(welcome_in_context); if (welcome != null && welcome.exists()) return welcome_in_context; } // not found return null; }
Resource resource = getResource(request);
Resource resource = getResource(request);
Resource resource = getResource(request);
Resource resource = getResource(request);
Resource resource = getResource(request);
Resource resource = getResource(request);
Resource resource = getResource(request);