Custom Date Format with jax-rs in apache cxf?

One simple apporach is take parameter as String and parse it in method body to convert it to java.util.Date.

One simple apporach is take parameter as String and parse it in method body to convert it to java.util. Date Another is create one class having constructor takes on parameter of type String. Perform same thing as I told in first approach.

Here is the code for second approach. @Path("date-test") public class DateTest{ @GET @Path("/print-date") public void printDate(@FormParam("date") DateAdapter adapter){ System.out. Println(adapter.getDate()); } public static class DateAdapter{ private Date date; public DateAdapter(String date){ try { this.

Date = new SimpleDateFormat("dd/MM/yyyy"). Parse(date); } catch (Exception e) { } } public Date getDate(){ return this. Date; } } } Hope this helps.

Starting from CXF 2.3.2 registering ParameterHandler will do it. It is also always possible to override the date value (passed as part of the query, etc) using RequestHandler filters for default Date(String) to work.

After reading the CXF codes (2.2.5), it is not possible, and it is hardcoded to use the Date(String) constructor, so whatever Date(String) support.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions