• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic