0

Stupid problem, but I can't solve it. Java server - glassfish 4. I have in WEB-INF tiles**.xml files. For example I have tiles.xml, tiles2.xml (I can have more in future) and I need to get them. I use the following code

Collection<ApplicationResource> webINFSet = 
applicationContext.getResources("/WEB-INF/tiles*.xml")

However it this code returns only one.

System.out.println("Size:"+webINFSet.size());//out Size:1

Where is my mistake?

1 Answers1

1

Looking at org.apache.tiles.request.servlet.ServletApplicationContext at GrepCode, which I assume is the implemenation you get, it seems as if the error (if there is any) is not on your side. The implementation looks like this:

public Collection<ApplicationResource> getResources(String path) {
  ArrayList<ApplicationResource> resources = new ArrayList<ApplicationResource>();
  resources.add(getResource(path));
  return resources;
}

Depending on what you need, you could try and look for the files on the classpath. There is, however, no standard way of searching for resources by name pattern, but you could have a look here: Get a list of resources from classpath directory

Community
  • 1
  • 1
Thomas
  • 87,414
  • 12
  • 119
  • 157