This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes ROOT directory behavior Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "ROOT directory behavior" Watch "ROOT directory behavior" New topic
Author

ROOT directory behavior

Jerome Chauveau
Greenhorn

Joined: Nov 14, 2005
Posts: 5
Hi all.

I create a directory test in webapps/ROOT.
When I go to url http://localhost:8080/test, a listing of the content of this directory is displayed.

Is there a way to have the same thing for directories not located in ROOT dir (for instance, D:/mydirs)?

Thanks in advance,

JC
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Directory listing capability can be controlled on an application basis by an entry in web.xml - find the <servlet> entry for the default servlet and use the listings parameter.

in the default web.xml is what I suggest for security purposes.
Bill
Jerome Chauveau
Greenhorn

Joined: Nov 14, 2005
Posts: 5
Thank you for your answer, Bill.

I stil can get the listing to appear.
What I did :
1 - Created directory t on c:/.
2 - Added
<Context path="/t" docBase="c:/t" crossContext="false" debug="1" reloadable="true" >
</Context>
into server.xml (after </host)
3 - Created WEB-INF direcroty in c:/t.
4 - Created a web.xml file into this directory with the init-param you gave me.

When i type : http://localhost:8080/t, it says : Resource /t was not found.

I think my context definition is not good or misplaced, I've tried several things but cannot get it to work.

Thanks in advance for your help.

JC
[ November 14, 2005: Message edited by: Jerome Chauveau ]
Jerome Chauveau
Greenhorn

Joined: Nov 14, 2005
Posts: 5
Hi all

I found the solution : the <context> must be between the <host></host>.

And it works fine, thanks again Bill.

JC
 
 
subject: ROOT directory behavior
 
Similar Threads
setting index.html to my context root
Context paths always coming up as "The requested resource is not available"
Without ROOT directory
how to use the servlet in tomcat??
Tomcat question