This week's giveaway is in the Java in General forum.
We're giving away four copies of Java Challengers and have Rafael del Nero on-line!
See this thread for details.
Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

how to stop server from serving index.jsp?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remove the welcome-file-list element from the web.xml file.

Also see https://coderanch.com/t/85744/Tomcat/keep-directory-browsing-off for how to prevent the directory contents from being listed.
 
Sheriff
Posts: 67528
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic