Thank you so much Chris, this worked.
On Oct 17, 8:49 pm, Chris <[EMAIL PROTECTED]> wrote:
> As others replied, this is the expected behavior. However, I also had
> the need to make sure the date object was not changed due to different
> timezones of the client and server. There is another thread, I don't
> have a link to it handy but you could search for something like "date
> serialization", where it was suggested to replace the gwt default date
> serialization logic. That is what I did.
>
> Warning, you need to compile the GWT java libraries yourself and this
> change affects all Date serialization. Since that is what I wanted, I
> didn't look for a more refined method that I could be applies to only
> specific dates. Here is what I replaced:
>
> The following file is in the user/src directory of the gwt source
> tree.
>
> Good luck,
> Chris....
> ================================================================
> package com.google.gwt.user.client.rpc.core.java.util;
>
> import com.google.gwt.user.client.rpc.SerializationException;
> import com.google.gwt.user.client.rpc.SerializationStreamReader;
> import com.google.gwt.user.client.rpc.SerializationStreamWriter;
>
> import java.util.Date;
>
> /**
> * Custom field serializer for [EMAIL PROTECTED] java.util.Date}.
> */
> public final class Date_CustomFieldSerializer {
>
> public static void deserialize(SerializationStreamReader
> streamReader,
> Date instance) {
> // No fields
> }
>
> public static Date instantiate(SerializationStreamReader
> streamReader)
> throws SerializationException {
> // return new Date(streamReader.readLong());
> return new
> Date(streamReader.readInt(),streamReader.readInt(),streamReader.readInt(),s
> treamReader.readInt(),streamReader.readInt());
> }
>
> public static void serialize(SerializationStreamWriter streamWriter,
> Date instance) throws SerializationException {
> // streamWriter.writeLong(instance.getTime());
> streamWriter.writeInt(instance.getYear());
> streamWriter.writeInt(instance.getMonth());
> streamWriter.writeInt(instance.getDate());
> streamWriter.writeInt(instance.getHours());
> streamWriter.writeInt(instance.getMinutes());
> }
>
> }
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---