File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes how to stop server from serving index.jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to stop server from serving index.jsp?" Watch "how to stop server from serving index.jsp?" New topic
Author

how to stop server from serving index.jsp?

poli reddy
Greenhorn

Joined: Nov 21, 2007
Posts: 15
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

Joined: Oct 14, 2008
Posts: 1337
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

Joined: Jan 10, 2002
Posts: 61187
    
  66

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).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
poli reddy
Greenhorn

Joined: Nov 21, 2007
Posts: 15
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to stop server from serving index.jsp?