cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: ParameterHandler not invoked for Date parameter
Date Wed, 18 Aug 2010 13:06:34 GMT
Hi

On Sat, Aug 7, 2010 at 11:27 PM, huntc <huntc@mac.com> 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:
>
>
>  &lt;cxf:rsServer id="rsServer"
>
> address="http://localhost:
> ${com.classactionpl.gpstrackerservices.httpPort}"
>
>
> serviceClass="com.classactionpl.gpsTrackerReference.GPSTrackerCollectionService"
>    staticSubresourceResolution="true"&gt;
>    &lt;cxf:providers&gt;
>      &lt;bean
>
>
> class="com.classactionpl.gpsTrackerReference.GPSTrackerCollectionProvider"&gt;
>        &lt;property name="gpsTrackerCollectionTransformer"
> ref="gpsTrackerCollectionTransformer" /&gt;
>      &lt;/bean&gt;
>      &lt;bean
> class="com.classactionpl.gpsTrackerReference.ISO8601ParameterHandler" /&gt;
>    &lt;/cxf:providers&gt;
>  &lt;/cxf:rsServer&gt;
>
>
> 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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message