This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I display local times in directory listings displayed via Tomcat 5.5.23?

 
Chris Loschen
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

We've got an intranet web site running on Tomcat 5.5.23 which displays directory listings. We've noticed that these listings always display with the time from the GMT time zone, not the local time zone, and we'd prefer to have the local time displayed.

Is this a configuration setting somewhere? If so, where? I could set a JAVA_OPT to -Duser.timezone=EST, but I'm not sure where Tomcat sets up its JVM options, and besides, that would force a single time zone when what I really want is to display the local time whatever that might be.

Thanks for your help!

Chris
 
Chris Loschen
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have any ideas on this? My web searches haven't been helpful so far. Thanks for your help!

Chris

Originally posted by Chris Loschen:
Hi all,

We've got an intranet web site running on Tomcat 5.5.23 which displays directory listings. We've noticed that these listings always display with the time from the GMT time zone, not the local time zone, and we'd prefer to have the local time displayed.

Is this a configuration setting somewhere? If so, where? I could set a JAVA_OPT to -Duser.timezone=EST, but I'm not sure where Tomcat sets up its JVM options, and besides, that would force a single time zone when what I really want is to display the local time whatever that might be.

Thanks for your help!

Chris
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked into it with no satisfactory solution. Seems to me you need a way to get the timezone the user's browser thinks it is in. HTTP seems to insist that all timestamps are in GMT.

Furthermore, in order to use Tomcat's default directory listing with special handling of file timestamps you would have to meddle with the default servlet source code.

How about this - use Javascript or cookies or user database or something to tag the user's request with the timezone and write your own directory listing code.

Writing directory listing code is not hard and gives you the opportunity of applying your own security rules to control what the user sees, insertion of href links for downloading, etc etc.

Bill
 
Chris Loschen
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Brogden:
How about this - use Javascript or cookies or user database or something to tag the user's request with the timezone and write your own directory listing code.

Writing directory listing code is not hard and gives you the opportunity of applying your own security rules to control what the user sees, insertion of href links for downloading, etc etc.

Bill


Thanks for your reply, Bill. Unfortunately, I'm not sure my bosses would be willing for me to spend that much time fixing an app that we're only using in-house.

I'd be willing to live with forcing EST if that's easier to accomplish, since most of our users are in the EST timezone.

On that front, I saw several other places where people were suggesting adding java options to the catalina.bat (or .sh) file. My installation of 5.5.23 didn't have any such files, but I do have them from an installation 5.5.20 so could probably make use of that. However, Tomcat is running as a Windows service in my environment and those files look like they're never actually called -- instead, it calls tomcat5.exe directly.

I found a catalina.properties file in the bootstrap.jar which apparently does get called when tomcat starts up, but I don't see anything in there which allows me to set any java_options.

I suspect my bosses would prefer that I give up on fixing the bug rather than rewrite all the directory listing code, just because of time concerns.

Does that help provide any leads? Thanks again for your help.

Chris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic