1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.struts2.osgi.loaders;
23
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.net.URL;
27
28 import org.apache.struts2.dispatcher.DefaultStaticContentLoader;
29 import org.apache.struts2.osgi.DefaultBundleAccessor;
30 import org.apache.struts2.osgi.BundleAccessor;
31 import com.opensymphony.xwork2.inject.Inject;
32
33 /***
34 * Loads static resources from bundles
35 *
36 */
37 public class StaticContentBundleResourceLoader extends DefaultStaticContentLoader {
38 private BundleAccessor bundleAccessor;
39
40 protected URL findResource(String path) throws IOException {
41 return bundleAccessor.loadResourceFromAllBundles(path);
42 }
43
44 @Inject
45 public void setBundleAccessor(BundleAccessor bundleAccessor) {
46 this.bundleAccessor = bundleAccessor;
47 }
48 }