There is another issue related to serialization of dates that can
occur due to emulation of long with double in generated JavaScript.

See:

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/1108020196cbf3f6


On Oct 17, 2:57 am, sim123 <[EMAIL PROTECTED]> wrote:
> Can some one please reply to my post, please!!!
> I just want to know if it is expected behavior, and if it is can I
> create custom serializer for not doing this conversion for example I
> tried changing Date_CustomFieldSerializer .java's code in to GWT
> source to be
>
>  public static void deserialize(SerializationStreamReader
> streamReader,
>       Date instance) {
>          // No fields
>   }
>
>   public static Date instantiate(SerializationStreamReader
> streamReader)
>       throws SerializationException {
>      Date d = Date.valueOf(streamReader.readString());
>      return d;
>   }
>
>   public static void serialize(SerializationStreamWriter streamWriter,
>           Date instance) throws SerializationException {
>           streamWriter.writeString(instance.toString());
>   }
>
> and it worked, it is not doing any conversion for Date, however I
> don't want to play with real GWT's code so just wondering if I could
> write custom serializer for java fields?
>
> I would really appreciate any help. Thanks
>
> On Oct 16, 8:28 pm, sim123 <[EMAIL PROTECTED]> wrote:
>
> > I looked into serialization code for Date/Time and Timestamp in
> > com.google.gwt.user.client.rpc.core.java.sql package, it seems that
> > these classes are cause of time zone conversion, is that so and is it
> > expected behavior?? Some one please help me.
>
> > Thanks.
>
> > On Oct 16, 6:21 pm, sim123 <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I noticed strange behavior of GWT serialization when handling Date/
> > > Time/Timestamp values. When client and servers are in different time
> > > zones like server is in GMT and client is running in PST time zone,
> > > RPC does timezone conversion for Date/Time and Timestamp, I am not
> > > sure if this is acceptable behavior and if it is then is there a way I
> > > could disable this conversion. Here is the example
> > > public class DateTest implements EntryPoint {
>
> > >         public void onModuleLoad() {
>
> > >                 Button b = new Button();
>
> > >                 b.addClickListener(new ClickListener() {
>
> > >                         public void onClick(Widget sender) {
> > >                                 DateServiceAsync dateService = 
> > > DateService.Util.getInstance();
> > >                                 dateService.getTimestamp(new 
> > > AsyncCallback<Timestamp>(){
>
> > >                                         public void onFailure(Throwable 
> > > caught) {
> > >                                                 // TODO Auto-generated 
> > > method stub
>
> > >                                         }
>
> > >                                         public void onSuccess(Timestamp 
> > > result) {
> > >                                                 TextBox tBox = new 
> > > TextBox();
> > >                                                 
> > > tBox.setText(result.toString());
> > >                                                 RootPanel.get().add(tBox);
> > >                                         }
>
> > >                                 });
> > >                         }
>
> > >                 });
> > >                 RootPanel.get().add(b);
>
> > > }
>
> > > Service Implementation
>
> > > public class DateServiceImpl extends RemoteServiceServlet implements
> > > DateService {
>
> > >         public Timestamp getTimestamp() {
> > >                 Timestamp t = new Timestamp(System.currentTimeMillis());
> > >                 System.out.println("timestamp at server" + t);
> > >                 return t;
> > >         }
>
> > > If server is running on GMT Time and client browser is in different
> > > timezone GWT does conversion (even for Date and Time types).
> > > Please suggest. Thansk for all the help and support.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to