Details
Description
I have created a REST API that takes a bean as its only parameter, and specifies the GET method. This converts the bean fields to query parameters. Two of the bean fields are java.util.Date instances.
When the WADL is generated for this service, the Date objects are rendered as beans instead of xs:dateTime instances, which means our clients cannot use the WADL for code generation.
As far as we can tell, this issue has the same root cause as CXF-5988; it appears that the WadlGenerator.doWriteBeanParam(...) method on line 807 needs to have the same fix applied where java.util.Date is treated as a special case.
@GET @Path("/") @WebMethod(action = "get") @WebResult(name = "getResponse") GetResponse get(@QueryParam("") @WebParam(name = "getRequest") GetRequest request)
@XmlRootElement(namespace = ...) @XmlType(namespace = ...) public class GetRequest { /** * Serial version UID. */ private static final long serialVersionUID = 1L; /** * Optional end date defining the lower boundary for the date range within which the entries are searched. */ @Past @XmlSchemaType(name = "dateTime") private Date endDate; /** * Required start date defining the lower boundary for the date range within which the entries are searched. */ @NotNull @Past @XmlElement(required = true) @XmlSchemaType(name = "dateTime") private Date startDate; /** * Retrieves the value for {@link #endDate}. * * @return the current value */ public Date getEndDate() { return this.endDate; } /** * Retrieves the value for {@link #startDate}. * * @return the current value */ public Date getStartDate() { return this.startDate; } /** * Provides a value for {@link #endDate}. * * @param endDate the new value to set */ public void setEndDate(Date endDate) { this.endDate = endDate; } /** * Provides a value for {@link #startDate}. * * @param startDate the new value to set */ public void setStartDate(Date startDate) { this.startDate = startDate; } }
<method name="GET" id="get"> <request> <param name="applicationId.name" style="query" type="xs:string"/> <param name="applicationId.version" style="query" type="xs:string"/> <param name="startDate.date" style="query" type="xs:int"/> <param name="startDate.hours" style="query" type="xs:int"/> <param name="startDate.minutes" style="query" type="xs:int"/> <param name="startDate.month" style="query" type="xs:int"/> <param name="startDate.seconds" style="query" type="xs:int"/> <param name="startDate.time" style="query" type="xs:long"/> <param name="startDate.year" style="query" type="xs:int"/> <param name="startDate.day" style="query" type="xs:int"/> <param name="startDate.timezoneOffset" style="query" type="xs:int"/> <param name="groupByType" style="query" type="xs:string"> <option value="DAY"/> <option value="MONTH"/> </param> <param name="pageNumber" style="query" type="xs:int"/> <param name="pageSize" style="query" type="xs:int"/> </request> <response> <representation mediaType="application/json" element="api1:getApplicationUsageResponse"/> </response> </method>
<method name="GET" id="get"> <request> <param name="applicationId.version" style="query" type="xs:string"/> <param name="applicationId.name" style="query" type="xs:string"/> <param name="groupByType" style="query" type="xs:string">...</param> <param name="startDate" style="query" required="true" type="xs:datetime"/> <param name="pageNumber" style="query" type="xs:int"/> <param name="pageSize" style="query" type="xs:int"/> </request> <response> <representation mediaType="application/json" element="api1:getApplicationUsageResponse"/> </response> </method>
Attachments
Issue Links
- is related to
-
CXF-5988 Provide support for a pluggable parameter conversion mechanism for JAX-RS client side proxies
- Closed