One simple apporach takes a parameter as a String and parses it in the body of the method to convert it to java.util.Date
Another is to create one class for which the constructor takes a parameter of type String. Do the same as I said in the first approach.
here is the code for the 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.
source share