• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to stop server from serving index.jsp?

 
poli reddy
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a application where I've index.jsp in jsps folder. If the user types http:[path]/conextpath/jsps, the server is redirecting automatically to index.jsp. But I dont want index.jsp to be redirected to the user. instead i want 404 error page to be shown to user. How can i do it? Here the server is redirecting page to index.jsp if it finds index.jsp in that folder. How can i stop this?
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the welcome-file-list element from the web.xml file.

Also see http://www.coderanch.com/t/85744/Tomcat/keep-directory-browsing-off for how to prevent the directory contents from being listed.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:Remove the welcome-file-list element from the web.xml file.

I'm willing to be that there isn't one. Tomcat (and others) supply a default which includes index.jsp.

I'd be more inclined to include a welcome-file-list entry, that specifies a servlet that issues the 404 (or whatever other behavior that you want the root URL to exhibit).
 
poli reddy
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Lester Burnham and Bear Bibeault.

That is really nice solution. I am using weblogic server. Could you also please tell me what is the xml file where i can set directory listing param to false?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic