389 total views, 9 views today

Access Server Files and directories using WebLogic -Directory -listing

Sometimes, we may have a requirement to access the server files, directory and others files on the server . One such requirement is user wants to access the WebLogic server log files but he does not possess read or write access to the machine. WebLogic provides a handy way to  access the files and directories over HTTP.

To achieve the directory listing, We need to create a simple java web project and add a weblogic.xml  under the WEB-INF directory. We don’t have to write any java class or any jsp file here. The Final project structure is look like below,

Project  >> WEB-INF >> web.xml

Project >> WEB-INF >> weblogic.xml

Project >> index.html

In this section, we are going to create this  web application that lists my below directories.

Directory1: C:\Oracle\Middleware\Oracle_Home\

Directory2: C:\softwares

The project zip file: public_html

 

1. Create a java web project using Eclipse or Jdeveloper

 

2. Create  weblogic.xml and place it under WEB-INF directory

Use the weblogic.xml file  mentioned below as a reference and modify the virtual-directory-mapping as per  your requirement.

The  ‘virtual-directory-mapping‘ in where I have listed my two directories.

Make the  ‘index-directory-enabled‘ to true . If you not set this element, you will get 403 Forbidden exception

The ‘context-root‘ is the context path of your URL. For example http://HOST/filedrive.

3. Create an index.html

I have created this html file for visualization, It has two  URL. Each url is dedicated to a directory.

Note:  the ‘href’ tag in this page and ‘url-pattern‘ in weblogic.xml should match.

 

 

4. Make the project as war file and deploy it in WebLogic server.

 

I have used eclipse to create and deploy this project into WebLogic server.

5. Test the URL in browser

 

Once I deployed the war file into the WebLogic server, i could access it through the URL by http://HOSTNAME:PORT>/CONTEXT_ROOT.

My project rendered in the browser like below, On clicking on each link , the page  will redirect to the corresponding directory.In the below screenshot, I have clicked the URL ORACLE_HOME
052516_0143_AccessServe3 Access Server Files and directories using WebLogic -Directory listing

The page is redirected and displaying the  directories inside C:\Oracle\Middleware\Oracle_Home\
052516_0143_AccessServe4 Access Server Files and directories using WebLogic -Directory listing

 

 

 

govindan Access Server Files and directories using WebLogic -Directory listing
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan Access Server Files and directories using WebLogic -Directory listing
Connect me
By | 2016-05-24T23:28:40+00:00 May 24th, 2016|Categories: WebLogic|Tags: , |0 Comments
Like us on Facebook.
Connect!