Search in sources :

Example 1 with URLApplicationResource

use of org.apache.tiles.request.locale.URLApplicationResource in project spring-framework by spring-projects.

the class SpringWildcardServletTilesApplicationContext method getResources.

@Override
public Collection<ApplicationResource> getResources(String path) {
    Resource[] resources;
    try {
        resources = this.resolver.getResources(path);
    } catch (IOException ex) {
        ((ServletContext) getContext()).log("Resource retrieval failed for path: " + path, ex);
        return Collections.emptyList();
    }
    if (ObjectUtils.isEmpty(resources)) {
        ((ServletContext) getContext()).log("No resources found for path pattern: " + path);
        return Collections.emptyList();
    }
    Collection<ApplicationResource> resourceList = new ArrayList<>(resources.length);
    for (Resource resource : resources) {
        try {
            URL url = resource.getURL();
            resourceList.add(new URLApplicationResource(url.toExternalForm(), url));
        } catch (IOException ex) {
            // Shouldn't happen with the kind of resources we're using
            throw new IllegalArgumentException("No URL for " + resource, ex);
        }
    }
    return resourceList;
}
Also used : URLApplicationResource(org.apache.tiles.request.locale.URLApplicationResource) ApplicationResource(org.apache.tiles.request.ApplicationResource) URLApplicationResource(org.apache.tiles.request.locale.URLApplicationResource) ApplicationResource(org.apache.tiles.request.ApplicationResource) URLApplicationResource(org.apache.tiles.request.locale.URLApplicationResource) Resource(org.springframework.core.io.Resource) ArrayList(java.util.ArrayList) ServletContext(javax.servlet.ServletContext) IOException(java.io.IOException) URL(java.net.URL)

Aggregations

IOException (java.io.IOException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 ServletContext (javax.servlet.ServletContext)1 ApplicationResource (org.apache.tiles.request.ApplicationResource)1 URLApplicationResource (org.apache.tiles.request.locale.URLApplicationResource)1 Resource (org.springframework.core.io.Resource)1