Hi Jeff,
Would that mean I have to get rid of Date fields from serialized/deserialized data types and change them to Sting? Then it would miss the point of convenient work with pojos with appropriate data filed types that could be used in different scenarios.

Gennady


On Thu, Dec 17, 2009 at 7:27 PM, Jeff Schnitzer <jeff@infohazard.org> wrote:
Why not just either:

1) Create a DateStringConverter that converts all dates, if you can
get away with doing it globally

or

2) Create a YourClassStringConverter that serializes whatever class
that contains the Date?  You can use your own ObjectMapper easily.

Jeff

Example:

----------------------------

package us.mobcasting.server.provider;

import java.util.Date;

import javax.ws.rs.ext.Provider;

import org.jboss.resteasy.spi.StringConverter;

/**
 * Allows us to create Dates from stringified long values (millis since epoch)
 *
 * @author Jeff Schnitzer <jeff@infohazard.org>
 */
@Provider
public class DateStringConverter implements StringConverter<Date>
{
       /** */
       @Override
       public Date fromString(String str)
       {
               return new Date(Long.parseLong(str));
       }

       /** */
       @Override
       public String toString(Date value)
       {
               return String.valueOf(value.getTime());
       }
}

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Resteasy-developers mailing list
Resteasy-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-developers