Example usage for org.springframework.web.context.support ServletContextResourcePatternResolver getResources

List of usage examples for org.springframework.web.context.support ServletContextResourcePatternResolver getResources

Introduction

In this page you can find the example usage for org.springframework.web.context.support ServletContextResourcePatternResolver getResources.

Prototype

@Override
    public Resource[] getResources(String locationPattern) throws IOException 

Source Link

Usage

From source file:ch.rasc.edsutil.optimizer.WebResourceProcessor.java

private List<Resource> enumerateResourcesFromWebapp(final String line, final String suffix) throws IOException {
    if (line.endsWith("/")) {
        ServletContextResourcePatternResolver resourceResolver = new ServletContextResourcePatternResolver(
                this.servletContext);
        String location = line + "**/*" + suffix;
        Resource[] resources = resourceResolver.getResources(location);
        return Arrays.asList(resources);
    }/*www.  j  a v a 2s .  c o m*/

    if (line.endsWith(suffix)) {
        return Collections.singletonList(new ServletContextResource(this.servletContext, line));
    }

    return Collections.emptyList();
}