Hi all,
When I run wadl2java on the following fragment of wadl, I get the API interface
defined below:
<response status="200">
<representation mediaType="application/json" element="user:users"/>
<representation mediaType="application/xml" element="user:users"/>
<param name="ETag" style="header" type="xsd:string">
<doc>The SHA1 hash of the sum of DN and modifiedTimestamp of the
matching users.</doc>
</param>
<param name="Cache-Control" style="header" type="xsd:string">
<doc>The Cache-Control header as specified through configuration in
context.xml.</doc>
</param>
<param name="Vary" style="header" type="xsd:string">
<doc>MUST have the value "Authorization", as we vary on the
Authorization header.</doc>
</param>
<doc>Return list of users. Must have admin role to receive the
response.
Note: no users = empty list with status:200</doc>
</response>
@GET
@Produces({"application/json", "application/xml" })
Users getUsers(@QueryParam("page") Long page, @QueryParam("pageSize") Long
pageSize, @QueryParam("sort") String sort, @QueryParam("fl") String fl,
@HeaderParam("If-None-Match") String If_None_Match,
@HeaderParam("Authorization") String Authorization);
The problem with the interface that is being produced above is that we return a
JAXB Users object, with no mechanism to return any of the ETag, Cache-Control
or Vary headers as required by the wadl.
How would I fix this?
Assuming I haven't made a mistake somewhere, ideally the method response should
be Response<Users> getUsers(…), but I am assuming this isn't possible in JAXRS
(is this correct?). Alternatively, if the response calls for headers being
returned, the generated interface should return a Response getUsers() instead
of Users getUsers(), which allows the implementation to return the data defined
by the wadl.
Would it be possible to confirm?
Regards,
Graham
--