Hi
On Sat, Aug 7, 2010 at 11:27 PM, huntc <[email protected]> wrote:
>
> Hi there,
>
> I've created a parameter handler to translate ISO8601 time strings into
> Java
> Date objects but the handler does not appear to be invoked (I get a "Class
> java.util.Date can not be instantiated using a constructor with a single
> String argument" error).
>
> My handler looks like this:
>
>
> public class ISO8601ParameterHandler implements ParameterHandler {
>
> @Override
> public Date fromString(String s) {
> return null;
> }
>
> }
>
>
I've just checked the code, you need to implement ParameterHandler<Date> -
can you try it please ? Also returning null will also currently result in
the runtime assuming no ParameterHandler has been found...
thanks, Sergey
>
> My service declaration looks like this:
>
>
> @GET
> @Path("/GPSTrackerCollection/gpsTrackers/GPSTracker/history")
> public Response getHistory(
> @DefaultValue("90.0") @QueryParam("id") double boundedByTopLat,
> @DefaultValue("-180.0") @QueryParam("boundedByLeftLong") double
> boundedByLeftLong,
> @DefaultValue("-90.0") @QueryParam("boundedByBottomLat") double
> boundedByBottomLat,
> @DefaultValue("180.0") @QueryParam("boundedByRightLong") double
> boundedByRightLong,
> @DefaultValue("20090808T00:00:00Z") @QueryParam("startValidTime") Date
> startValidTime,
> @DefaultValue("20090808T00:00:00Z") @QueryParam("endValidTime") Date
> endValidTime,
> @DefaultValue("10") @QueryParam("numTimeSlices") int numTimeSlices) {
>
>
> I register it as follows:
>
>
> <cxf:rsServer id="rsServer"
>
> address="http://localhost:
> ${com.classactionpl.gpstrackerservices.httpPort}"
>
>
> serviceClass="com.classactionpl.gpsTrackerReference.GPSTrackerCollectionService"
> staticSubresourceResolution="true">
> <cxf:providers>
> <bean
>
>
> class="com.classactionpl.gpsTrackerReference.GPSTrackerCollectionProvider">
> <property name="gpsTrackerCollectionTransformer"
> ref="gpsTrackerCollectionTransformer" />
> </bean>
> <bean
> class="com.classactionpl.gpsTrackerReference.ISO8601ParameterHandler" />
> </cxf:providers>
> </cxf:rsServer>
>
>
> Any ideas or suggestions on a better way to pass dates using REST?
>
> Kind regards,
> Christopher
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/ParameterHandler-not-invoked-for-Date-parameter-tp2267734p2267734.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>