In this article I will show how to create a simple WebLogic application that lets you navigate directories and files on a server. This can be one of the handiest utilities. I use it all the time to give developers access to logs in test and pre-production environments.
But first, a warning... Be careful what files you make available to others. Some files, especially within a WebLogic domain directory, contain information that MUST be kept secret if the domain is to remain secure. NEVER provide read-access to all files in a WebLogic domain directory.
Like any WebLogic application, you must create a WAR file with the following components inside:
The web.xml descriptor
Inside the WEB-INF directory, create a new file called web.xml, and paste the following XML code:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>
I won't explain this XML code, but it is essentially an empty deployment descriptor.
The weblogic.xml descriptor
Create another file in the WEB-INF directory called weblogic.xml, and paste the following into it:
<!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>../../../logs/</local-path>
<url-pattern>*</url-pattern>
</virtual-directory-mapping>
<context-root>/getlogs</context-root>
</weblogic-web-app>
XML Elements Explained
<index-directory-enabled> If true, WebLogic will display a list of directories and files. Unfortunately, you cannot filter this list. WebLogic does not provide much in the way of directory/file listing functionality - either you list them or don't.
<local-path> The path component of a URL where you will find the application. For example, the XML code above will make the application accessible at http://localhost:7001/getlogs/
<url-pattern> Specifies the local directory that will be displayed when a user navigates to the context-root.
<context-root> A pattern that URLs must match in order for them to be mapped to the local directory.
But first, a warning... Be careful what files you make available to others. Some files, especially within a WebLogic domain directory, contain information that MUST be kept secret if the domain is to remain secure. NEVER provide read-access to all files in a WebLogic domain directory.
Like any WebLogic application, you must create a WAR file with the following components inside:
- WEB-INF (directory)
- WEB-INF\web.xml
- WEB-INF\weblogic.xml
The web.xml descriptor
Inside the WEB-INF directory, create a new file called web.xml, and paste the following XML code:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>
I won't explain this XML code, but it is essentially an empty deployment descriptor.
The weblogic.xml descriptor
Create another file in the WEB-INF directory called weblogic.xml, and paste the following into it:
<!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>../../../logs/</local-path>
<url-pattern>*</url-pattern>
</virtual-directory-mapping>
<context-root>/getlogs</context-root>
</weblogic-web-app>
XML Elements Explained
Sample Applications (update)
The sample apps from this article can be downloaded here. These sample applications are NOT SAFE for a production environment as they could potentially expose sensitive information.
The sample apps from this article can be downloaded here. These sample applications are NOT SAFE for a production environment as they could potentially expose sensitive information.
Deployment Notes:
- For WebLogic 8.1 or older, when deploying you must select "Copy this Web Application module onto every target for me".
- For WebLogic 9 or newer, deploy with default options.
Thanks, do you have like a sample war file which you can send me at ravi_tiwari_786@yahoo.com, i really need this kind of features for the dvelopers and the testing team.
ReplyDeleteDirectory Listing - A Simple Weblogic Application >>>>> Download Now
Delete>>>>> Download Full
Directory Listing - A Simple Weblogic Application >>>>> Download LINK
>>>>> Download Now
Directory Listing - A Simple Weblogic Application >>>>> Download Full
>>>>> Download LINK GA
Hi Ravi, the sample war files are now available from the links above.
ReplyDeleteIt worked. I made the WAR file with WinRAR as a Zip, and just changed the extension to WAR. I had to deploy the application (Prepared), then start the deployment (Active). Thank you.
ReplyDeletehello, I was looking for your sample war file and the link was not working at all. Will you be kind enough to send the sample war file to me chua.mykel@gmail.com
ReplyDeleteThanks.
Hello, I would like to do the same; publish log files to developers. My issue is, that the directory listing shows the files, but if I want to download files, which are not small, they are getting truncated.
ReplyDeleteIs there a configuration, which has to be changed. Interesting is also, that the size seems to be different between broswers.
Thanks
after deployment...i got 403 requesting getlogs. why?
ReplyDeletehello, I was looking for your sample war file and the link was not working at all. Will you be kind enough to send the sample war file to me yu.randy@gmail.com
ReplyDeleteThanks.
hello, I was looking for your sample war file and the link was not working at all. Will you be kind enough to send the sample war file to me fongtsz@gmail.com
ReplyDeletehello, I was as well looking for your sample war file and the link was not working, will you be so kind enough to send me the sample war file @ gmail addess srinivas.bnglr@gmail.com
ReplyDeleteNice post, I have used the same approach to retrieve logs from a remote WLS, a war file can be retrieved from:
ReplyDeletehttps://github.com/devwebcl/wls_contraption
Thanks for the article. Its pretty simple
ReplyDeleteSample download link doesn't works. Anyways easy to create the 2 xml files.
Is there any way to change the file date modified format? for my it is listing as DD-MM-YYYY, but wanted to change to YYYY-MM-DD?
ReplyDeleteDirectory Listing - A Simple Weblogic Application >>>>> Download Now
ReplyDelete>>>>> Download Full
Directory Listing - A Simple Weblogic Application >>>>> Download LINK
>>>>> Download Now
Directory Listing - A Simple Weblogic Application >>>>> Download Full
>>>>> Download LINK C9
Dengan memahami secara mendalam cara kerja website directory listing, bisnis online dapat mengoptimalkan manfaat dari strategi ini. Submisi informasi yang akurat, kategorisasi yang tepat, verifikasi data, optimasi kata kunci, dan pemberian backlink menjadi tahapan kunci dalam proses ini.
ReplyDeleteKeunggulan Website Directory Listing menjadi lebih penting daripada sebelumnya. Dengan meningkatkan relevansi, otoritas SEO, dan citra bisnis Anda, praktik ini membuka pintu untuk kesempatan dan pertumbuhan yang signifikan.
Penting untuk memahami dan memanfaatkan dengan baik fungsi website directory listing online agar dapat membangun fondasi yang kuat dan berkelanjutan untuk pertumbuhan bisnis online Anda. Dengan strategi ini, bisnis Anda dapat bersaing secara efektif dalam pasar digital yang terus berkembang.
Thanks and that i have a super provide: How Much Should House Renovations Cost house renovation exterior
ReplyDelete