This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Open a folder as a window in tomcat  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am able to see the folder contents as listing in html page, i need to open the folder as a window.. please help.

or is there any way to download all the contents displayed in listing with single click without making zip file of all those contents.
 
Bartender
Posts: 19657
92
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A web server is not a file server. What happens when you "request a directory" via HTTP is totally unlike what happens when you use a File I/O call to list a directory.

In Tomcat, if you make a URL request that doesn't match any of the servlet URL patterns in the web.xml file for that particular web application context, the URL request - and the URL - are passed to Tomcat's Default Servlet, which is built into Tomcat itself. This servlet first attempts to match the URL against a JSP, and if that doesn't work, determines if the tail-end of the URL matches a relative resource path within the application WAR. If so, then the Default Servlet determines whether this resource is a data resource ("file") or a container resource ("directory"). I'm using the names in quotes because an actual WAR is not a filesystem directory, it's a ZIP file and the server's filesystem cannot read ZIP members directly, but Tomcat can.

In the case of a "directory" resource, there's logic in the Default Servlet that constructs an HTTP page, enumerates the members of that "directory", and formats the enumeration in tabular format, giving a "directory listing" in the client's view (browser).

In order to override that behavior, you are going to have to create the equivalent of the Default Servlet, map it to a suitable URL path(s) and handle those URLs in whatever format you prefer.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!