List of usage examples for org.springframework.web.context.support ServletContextResource getPath
public final String getPath()
From source file:org.jnap.core.assets.StaticAssetsHandler.java
protected void resetResource(Resource resource) throws IOException { File file = null;//from ww w . j ava2 s. c om if (!resource.exists()) { ServletContextResource servletResource = (ServletContextResource) resource; file = new File(WebUtils.getRealPath(servletContext, "/") + servletResource.getPath()); } else { file = resource.getFile(); } if (file.exists()) { file.delete(); } file.createNewFile(); }
From source file:org.springframework.web.context.support.ServletContextResourcePatternResolver.java
/** * Overridden version which checks for ServletContextResource * and uses {@code ServletContext.getResourcePaths} to find * matching resources below the web application root directory. * In case of other resources, delegates to the superclass version. * @see #doRetrieveMatchingServletContextResources * @see ServletContextResource//from w w w. java 2 s . co m * @see javax.servlet.ServletContext#getResourcePaths */ @Override protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource, String subPattern) throws IOException { if (rootDirResource instanceof ServletContextResource) { ServletContextResource scResource = (ServletContextResource) rootDirResource; ServletContext sc = scResource.getServletContext(); String fullPattern = scResource.getPath() + subPattern; Set<Resource> result = new LinkedHashSet<>(8); doRetrieveMatchingServletContextResources(sc, fullPattern, scResource.getPath(), result); return result; } else { return super.doFindPathMatchingFileResources(rootDirResource, subPattern); } }