You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Michael Schechter (JIRA)" <ji...@apache.org> on 2014/12/05 14:46:12 UTC

[jira] [Created] (CXF-6137) WADL generation does not correctly support query parameters

Michael Schechter created CXF-6137:
--------------------------------------

             Summary: WADL generation does not correctly support query parameters
                 Key: CXF-6137
                 URL: https://issues.apache.org/jira/browse/CXF-6137
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS, Tooling
    Affects Versions: 3.0.2
         Environment: Windows/Linux; Red Hat JBoss EAP 6.2.2; Java 7u40
            Reporter: Michael Schechter


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.

{code:java|title=API definition}
    @GET
    @Path("/")
    @WebMethod(action = "get")
    @WebResult(name = "getResponse")
    GetResponse get(@QueryParam("") @WebParam(name = "getRequest") GetRequest request)
{code}

{code:java|title=Bean definition}
@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;
    }
}
{code}

{code:xml|title=Current WADL content}
<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>
{code}

{code:xml|title=Expected WADL content}
<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>
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)