Oh!! so no one knows is it the expected behavior? Or it could be
changed? Can any one please suggest that creating custom serializers
for java classes is a good idea or not and what could be the pros and
cons of this approach?

Thanks.

On Oct 18, 5:46 am, "Manuel Carrasco" <[EMAIL PROTECTED]>
wrote:
> I had the same problem passing java.util.Date from client to server. When
> they use different TZ,  dates differ. Eventually I use String representation
> of the dates for client/server dialog, and use DateTimeFormat for
> transformations.
>
> On Fri, Oct 17, 2008 at 6:36 PM, Tahir Akhtar <[EMAIL PROTECTED]>wrote:
>
>
>
> > 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/threa...
>
> > 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 [email protected]
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