org.apache.catalina.WebResourceRoot.ResourceSetType Java Examples

The following examples show how to use org.apache.catalina.WebResourceRoot.ResourceSetType. 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
    }
  }
}