Java Code Examples for org.apache.catalina.WebResourceRoot#createWebResourceSet()

The following examples show how to use org.apache.catalina.WebResourceRoot#createWebResourceSet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FatJarWebXmlListener.java    From oxygen with Apache License 2.0 5 votes vote down vote up
private void createWebResource(Context context, WebResourceRoot resources, String path) {
  log.info(String.format("create web resources for [%s]", path));
  URL resource = context.getParentClassLoader().getResource(path);
  if (resource != null) {
    String webXmlUrlString = resource.toString();
    try {
      URL root = new URL(webXmlUrlString.substring(0, webXmlUrlString.length() - path.length()));
      String webPath = Strings.SLASH + path;
      resources.createWebResourceSet(ResourceSetType.RESOURCE_JAR, webPath, root, webPath);
    } catch (MalformedURLException e) {
      // ignore
    }
  }
}
 
Example 2
Source File: JsfTomcatApplicationListener.java    From joinfaces with Apache License 2.0 5 votes vote down vote up
private void addMainJarResourceSet(WebResourceRoot resources) throws URISyntaxException {
	String webAppMount = "/";
	String archivePath = null;
	String internalPath = "/META-INF/resources";
	String bootInfPath = "/BOOT-INF/classes";

	resources.createWebResourceSet(WebResourceRoot.ResourceSetType.POST,
		webAppMount, base(mainFile(resources)), archivePath, internalPath);
	resources.createWebResourceSet(WebResourceRoot.ResourceSetType.POST,
		webAppMount, base(mainFile(resources)), archivePath, bootInfPath + internalPath);
}