Monday, July 8, 2013

Downloading files from a WebLogic WebApp

If you want to download from your WebLogic webapp any file located anywhere in your filesystem, use the virtual-directory-mapping clause in the weblogic.xml of your webapp:


<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/we
blogic810-web-jar.dtd">

<weblogic-web-app>

<container-descriptor>
<index-directory-enabled>true</index-directory-enabled>
</container-descriptor>

<virtual-directory-mapping>
<local-path>/opt/oracle/apps/downloads/</local-path>
<url-pattern>/files/*</url-pattern>
</virtual-directory-mapping>

</weblogic-web-app>




In this case, the folder /opt/oracle/apps/downloads/files should exist, and you can download a file in it by specifying http://myserver.acme.com:7001/mywebapp/files/myfile.txt

1 comment:

Unknown said...

People can easily learn how to download files from a web logic web application. Thanks for sharing this function. Web app developer service