Hi Carl-Erik
On 08/10/12 21:31, Carl-Erik Kopseng wrote:
I think I might have found some kind of bug related to QueryParam, but
to make sure, I am posting it here first for input.

Using QueryParam("") MyClass myInput is usually a nice shortcut for
generating a WADL where the fields of MyClass are documented with type
and name. This has worked nicely for any classes composed of simple
fields, such as integers, doubles, Strings, etc, and for complex
Collection-ish fields (such as MyFoo[] foos), the type is not shown in
the WADL.

Today I had a class where one field is complex, and not of a array or
collection type, and to my surprise, the fields of this complex field
were shown. That was new to me! Unfortunately, all the other
parameters (fields of the input object) were _not_ shown. If my
description seems a bit unclear, I pasted the code and resulting wadl
snippet at http://pastebin.com/zqPi7Rfd and  below. Is this a bug or a
really weird feature? Using CXF JAX-RS 2.6.2

calculateCurrencyExchange(@QueryParam("") CurrencyExchangeInput input){
      ...
}

class ExchangeableCurrenciesInput {

        private ExchangeType type;
        private boolean showExchangeRates;
        private boolean showMargins;
        private boolean showProxyCurrencies;

         ...
}
class ExchangeType {

        private Long id;
        private String name;
        private String description;
         ...
}

<resource path="/getExchangeableCurrencies">
<method name="GET">
<request>
<param name="type.name" style="query" type="xs:string"/>
<param name="type.id" style="query" type="xs:long"/>
<param name="type.description" style="query" type="xs:string"/>
</request>
<response>
<representation mediaType="application/json"/>
</response>
</method>
</resource>

I have a test with simple and complex fields, but that may be a bit brittle, the actual code dealing with that, may be even an ordering issue, example, having 'private ExchangeType type' as the last field may work better, I'll investigate

Sergey

--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to