You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by huntc <hu...@mac.com> on 2010/09/11 17:47:45 UTC
Re: ParameterHandler not invoked for Date parameter
Hi Sergey,
Sorry for the delayed reply; just got around to trying this again with your
recommendation.
Unfortunately my handler is still not getting invoked. Here's its current
declaration:
/**
* Converts ISO8601 parameters into date objects.
*
* @author huntc
*
*/
@Provider
public class ISO8601TimestampParameterHandler implements ParameterHandler {
/**
* Cooerce an ISO8601 time string to a date object.
*
* @param s
* the string to parse.
* @return the date object or null if the string cannot be parsed.
*/
@Override
public Date fromString(String s) {
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
try {
return new Date(dateFormat.parse(s).getTime());
} catch (ParseException e) {
return null;
}
}
}
Any more thoughts?
Kind regards,
Christopher
--
View this message in context: http://cxf.547215.n5.nabble.com/ParameterHandler-not-invoked-for-Date-parameter-tp2267734p2836108.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: ParameterHandler not invoked for Date parameter
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
can you please confirm you have
"implements ParameterHandler<Date>" ?
thanks, Sergey
On Sat, Sep 11, 2010 at 4:47 PM, huntc <hu...@mac.com> wrote:
>
> Hi Sergey,
>
> Sorry for the delayed reply; just got around to trying this again with your
> recommendation.
>
> Unfortunately my handler is still not getting invoked. Here's its current
> declaration:
>
>
> /**
> * Converts ISO8601 parameters into date objects.
> *
> * @author huntc
> *
> */
> @Provider
> public class ISO8601TimestampParameterHandler implements ParameterHandler {
>
> /**
> * Cooerce an ISO8601 time string to a date object.
> *
> * @param s
> * the string to parse.
> * @return the date object or null if the string cannot be parsed.
> */
> @Override
> public Date fromString(String s) {
> SimpleDateFormat dateFormat = new SimpleDateFormat(
> "yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
> dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
> try {
> return new Date(dateFormat.parse(s).getTime());
> } catch (ParseException e) {
> return null;
> }
> }
> }
>
>
> Any more thoughts?
>
> Kind regards,
> Christopher
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/ParameterHandler-not-invoked-for-Date-parameter-tp2267734p2836108.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>