PDA

View Full Version : sort directories and files using DirectoryServlet


warpedmind05
08-24-2010, 08:26 PM
Is it possible to sort directories and files using the directoryservlet?
I added the DirectoryServlet class to my resin.conf like this:

<servlet servlet-name="directory" servletclass = "com.caucho.servlets.DirectoryServlet"/>

However, it doesn't order the files in any discernible manner. Is there a way to alphabetise them in ascending order?

Thanks,
Stephanie

emil
08-24-2010, 08:50 PM
Hi Stephanie,

Not out of the box, but it wouldn't be hard to modify. Do you want all the directories first, then the files? Or do you want directories and files sorted together?

Emil

warpedmind05
08-24-2010, 08:56 PM
I don't think it really matters how it got sorted, as long as it got sorted :)
My initial thought was to create a class that extends DirectoryServlet and write the code to display the contents. Is there an easier way?

emil
08-24-2010, 10:29 PM
Hi Stephanie,

Yes, there's an easier way... I can just do it. :) See the attached servlet.

Emil