0

How to resolve Wildfly vfs URL to physical URL? e.g.

vfs:/C:/wildfly-20.0.1.Final/bin/content/foo.ear/myejb.jar/

The java code must not have dependency on Wildfly or other libraries.

eastwater
  • 4,624
  • 9
  • 49
  • 118
  • VFS is used in Wildfly/JBoss in this case for something that resides within an archive file of some sort. There is a physical location for this resource but it's not a filesystem physical location. It's not clear what you're trying to get to. If your code needs to start with `if(location.startsWith("vfs"))` then that still allows it to run in something besides Wildfly. – stdunbar Jul 22 '20 at 16:25
  • Thanks. How to resolve the VFS URI to a physical URI such as file:/ or jar:/ that exists on regular file system? – eastwater Jul 22 '20 at 21:56
  • There is no `file://` conversion as the file you're looking for is embedded inside a `.jar` file. There is no physical file - it's inside of the jar. Regardless of the application server you will need to read the file out of the jar using something like [this post](https://stackoverflow.com/questions/20389255/reading-a-resource-file-from-within-jar). – stdunbar Jul 22 '20 at 22:15
  • We can read a file inside a jar URL (jar://). But is there a way to know the physical location for VFS so that we can do something with it? Wildfly/Jboss should resolve VFS URL before passing it to an app or component. Otherwise it would create a dependency on Wildfly. – eastwater Jul 22 '20 at 22:26

0 Answers0