/** * This implementation supports file paths beneath the root of the web application. * @see ServletContextResource */ @Override protected Resource getResourceByPath(String path) { return new ServletContextResource(this.servletContext, path); }
/** * This implementation supports file paths beneath the root of the ServletContext. * @see ServletContextResource */ @Override protected Resource getResourceByPath(String path) { Assert.state(this.servletContext != null, "No ServletContext available"); return new ServletContextResource(this.servletContext, path); }
/** * This implementation supports file paths beneath the root of the ServletContext. * @see ServletContextResource */ @Override protected Resource getResourceByPath(String path) { Assert.state(this.servletContext != null, "No ServletContext available"); return new ServletContextResource(this.servletContext, path); }
/** * This implementation supports file paths beneath the root of the ServletContext. * @see ServletContextResource */ @Override protected Resource getResourceByPath(String path) { Assert.state(this.servletContext != null, "No ServletContext available"); return new ServletContextResource(this.servletContext, path); }
/** * This implementation supports file paths beneath the root of the web application. * @see ServletContextResource */ @Override protected Resource getResourceByPath(String path) { return new ServletContextResource(this.servletContext, path); }
/** * This implementation supports file paths beneath the root of the ServletContext. * @see ServletContextResource */ @Override protected Resource getResourceByPath(String path) { Assert.state(this.servletContext != null, "No ServletContext available"); return new ServletContextResource(this.servletContext, path); }
/** * This implementation supports file paths beneath the root of the ServletContext. * @see ServletContextResource */ @Override protected Resource getResourceByPath(String path) { Assert.state(this.servletContext != null, "No ServletContext available"); return new ServletContextResource(this.servletContext, path); }
/** * This implementation supports file paths beneath the root of the ServletContext. * @see ServletContextResource */ @Override protected Resource getResourceByPath(String path) { Assert.state(this.servletContext != null, "No ServletContext available"); return new ServletContextResource(this.servletContext, path); }
/** * This implementation creates a ServletContextResource, applying the given path * relative to the path of the underlying file of this resource descriptor. * @see org.springframework.util.StringUtils#applyRelativePath(String, String) */ @Override public Resource createRelative(String relativePath) { String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); return new ServletContextResource(this.servletContext, pathToUse); }
/** * This implementation creates a ServletContextResource, applying the given path * relative to the path of the underlying file of this resource descriptor. * @see org.springframework.util.StringUtils#applyRelativePath(String, String) */ @Override public Resource createRelative(String relativePath) { String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); return new ServletContextResource(this.servletContext, pathToUse); }
result.add(new ServletContextResource(servletContext, currPath));
@Test public void testServletContextResourceWithRelativePath() throws IOException { MockServletContext sc = new MockServletContext(); Resource resource = new ServletContextResource(sc, "dir/"); Resource relative = resource.createRelative("subdir"); assertEquals(new ServletContextResource(sc, "dir/subdir"), relative); }
@Test public void testServletContextResource() throws IOException { MockServletContext sc = new MockServletContext(); Resource resource = new ServletContextResource(sc, "org/springframework/core/io/Resource.class"); doTestResource(resource); assertEquals(resource, new ServletContextResource(sc, "org/springframework/core/../core/io/./Resource.class")); }
@Test public void checkServletContextResource() throws Exception { Resource classpathLocation = new ClassPathResource("test/", PathResourceResolver.class); MockServletContext context = new MockServletContext(); ServletContextResource servletContextLocation = new ServletContextResource(context, "/webjars/"); ServletContextResource resource = new ServletContextResource(context, "/webjars/webjar-foo/1.0/foo.js"); assertFalse(this.resolver.checkResource(resource, classpathLocation)); assertTrue(this.resolver.checkResource(resource, servletContextLocation)); }
result.add(new ServletContextResource(servletContext, currPath));
@Override protected Resource getResourceByPath(String path) { if (getServletContext() == null) { return new ClassPathContextResource(path, getClassLoader()); } return new ServletContextResource(getServletContext(), path); }
@Override protected Resource getResourceByPath(String path) { if (this.applicationContext.getServletContext() != null) { return new ServletContextResource( this.applicationContext.getServletContext(), path); } return super.getResourceByPath(path); }
/** * This implementation supports file paths beneath the root of the web application. * @see ServletContextResource */ protected Resource getResourceByPath(String path) { return new ServletContextResource(this.servletContext, path); }
/** * This implementation creates a ServletContextResource, applying the given path * relative to the path of the underlying file of this resource descriptor. * @see org.springframework.util.StringUtils#applyRelativePath(String, String) */ public Resource createRelative(String relativePath) throws IOException { String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); return new ServletContextResource(this.servletContext, pathToUse); }
/** * This implementation creates a ServletContextResource, applying the given path * relative to the path of the underlying file of this resource descriptor. * @see org.springframework.util.StringUtils#applyRelativePath(String, String) */ @Override public Resource createRelative(String relativePath) { String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); return new ServletContextResource(this.servletContext, pathToUse); }