Real path to a virtual directory

1.1k Views Asked by At

I setup a mapping to my images directory in Weblogic.xml by using the virtual-directory-mapping tag. How can I read the value of the real path so that my application can access that virtual directory for write access?

JMX seems to be of no help here since the WebServerMBean (or any other MBean) doesn't seem to provide access to the virtual-directory-mapping property.

Java Servlet API also has not yielded result since calling getRealPath() is only appending the url-pattern to the deployment directory of the application and not giving the correct path.

<virtual-directory-mapping>
    <local-path>/home/wlsadm/images</local-path>
    <url-pattern>help/specimens/*</url-pattern>
    <url-pattern>*.xml</url-pattern>
</virtual-directory-mapping>
1

There are 1 best solutions below

0
Steve Siebert On

I've done a fair amount of research on this, reading vendor documentation, reading blogs, forums, etc. As the OP indicated, JMX use to be an approach to get this information, but this is no longer an option in current Weblogic versions.

The only solution I think you're left with is to create a utility that reads the information from the weblogic.xml file on the classpath. Something like an application listener that reads it on application startup and makes it available as a servlet attribute, etc.

Would love to hear how you solved it, though.