Hi,

On Mon, Jan 30, 2012 at 11:27 PM, Chris Merrill
<[email protected]> wrote:
> I should add another strange detail to this - the DateTimeField works 
> correctly if I
> establish a new browser eb session within the debug session.  I'm working on 
> AppEngine
> and the SDK will save the session states when it shuts down. When I start a 
> new
> debug session, my existing browser session resumes where I left off and 
> DateTimeField
> gets a null TimeZone. When I logout and log back in, it is then fine.
>
> Could this be AppEngine related?  Could it be that I'm getting the right 
> timezone
> because it is in my session and therefore cached, but the ClientInfo is not?
> Shouldn't the ClientInfo be re-requested automagically from the browser if it 
> isn't
> in the session?

ClientInfo by default contains just the basic information extracted
from User-Agent header.
You need to use
org.apache.wicket.settings.IRequestCycleSettings#setGatherExtendedBrowserInfo(true)
to get more details about the client.
See for example http://www.wicket-library.com/wicket-examples/hellobrowser/
>
> TIA!
> Chris
>
>
> On 1/30/2012 4:19 PM, Chris Merrill wrote:
>> I'm using the yui.calendar.DateTimeField widget on a page with some other
>> timezone sensitive data and I get the right timezone on the other fields
>> but not with DateTimeField.  When I stepped into the DateTimeField code,
>> I came to line 417:
>>
>>                       TimeZone zone = getClientTimeZone();
>> which takes me to:
>>
>>       protected TimeZone getClientTimeZone()
>>       {
>>               ClientInfo info = Session.get().getClientInfo();
>>               if (info instanceof WebClientInfo)
>>               {
>>                       return 
>> ((WebClientInfo)info).getProperties().getTimeZone();
>>               }
>>               return null;
>>       }
>>
>> This method is returning null via this line:
>>                       return 
>> ((WebClientInfo)info).getProperties().getTimeZone();
>> All the properties in the ClientInfo appear to be defaults.
>>
>>
>> Now, I'm doing pretty much the same thing in my session, where I'm caching
>> the timezone (our base page checks the timezone via the session, so this
>> happens when new sessions are established).
>>
>>     public TimeZone getTimeZone()
>>         {
>>         if (_timezone == null)
>>             {
>>             _timezone = getClientInfo().getProperties().getTimeZone();
>>             if (_timezone == null)
>>                 _timezone = TimeZone.getTimeZone("US/Eastern");
>>             }
>>         return _timezone;
>>         }
>>
>> This part works fine - all the pages that need the timezone get it and render
>> date/times correctly.
>>
>> I was able to easily work around this by subclassing DateTimeField and 
>> pushing
>> in the timezone manually - but I'm wondering what I'm doing wrong that is 
>> causing
>> the timezone to break in DateTimeField?  (I'm assuming this works for 
>> everyone
>> else but me).
>>
>> Any ideas?
>>
>> TIA!
>> Chris
>>
>>
>>
>
>
> --
> ------------------------------------------------------------------------ -
> Chris Merrill                           |  Web Performance, Inc.
> [email protected]                |  http://webperformance.com
> 919-433-1762                            |  919-845-7601
>
> Web Performance: Website Load Testing Software & Services
> ------------------------------------------------------------------------ -
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to