aspose file tools*
The moose likes Tomcat and the fly likes Sorting directory listings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Sorting directory listings" Watch "Sorting directory listings" New topic
Author

Sorting directory listings

Leo Budima
Greenhorn

Joined: Jun 06, 2005
Posts: 10
Tomcat doesn't sort directory listings in my application at all, is there a way to affect this so that subdirs are shown first as usual? I know that default servlet manages this but I haven't found a way to affect this

Thanks!
Joseph Marques
Greenhorn

Joined: May 01, 2005
Posts: 12
What do you mean that "Tomcat" isn't sorting your directories? Are you trying to execute a piece of code, and that code isn't returning the directories in the order you desire? If so, please post the code fragment and I'll try to help.

-joe
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

I believe that Leo is referring to the directory listing that is generated when a folder is referenced that doesn't contain any of the "start pages" (index.html, index.jsp, et al).

What do yo mean by


doesn't sort directory listings in my application at all


?

My Tomcat installation correctly shows the files and folders in alphabetical order.


is there a way to affect this so that subdirs are shown first as usual?


This is hardly "as usual". Other than in the Windows File Explorer I know of nowhere that folders are bunched up at the top of a listing.

You could always write your own if you are unhappy with the correct sort order of the default servlet.
[ July 06, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Leo Budima
Greenhorn

Joined: Jun 06, 2005
Posts: 10
Sorry if I wasn't clear enough, my apologies. Yes, as Bear said, I was refering to a situation where Tomcat's default servlet lists current directory contents when there is no welcome page.

I'm using globalXsltFile to style directory listing and showing this as a download page in my application. However, subdirectories are shown among the other files and the files are not sorted alphabetically at all which is pretty unconvenient. It has nothing to do with the fact that I'm using my own xslt file since it's the same when I use the default behaviour.

Do you think that this is a configuration or installation problem in my specific case?

The only way to change sorting generaly would be to rewrite the default servlet?

Thank you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sorting directory listings